Add-WebConfiguration

Adds a collection element to an IIS configuration collection.

Syntax

Add-WebConfiguration
   [-Value <PSObject>]
   [-Clr <String>]
   [-AtElement <Hashtable>]
   [-AtIndex <Int32>]
   [-AtName <String>]
   [-Force]
   [-Location <String[]>]
   [-Filter] <String[]>
   [[-PSPath] <String[]>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Add-WebConfiguration cmdlet adds a collection element to an existing IIS configuration collection.

Examples

-------------- EXAMPLE 1: Add a new Default Document --------------

IIS:\>Add-WebConfiguration //defaultDocument/files "IIS:\sites\Default Web Site" -atIndex 0 -Value @{value="new-index.html"}

This example adds a new Default Document to the Default Document collection of the Default Web Site. By using "-atIndex 0" the new Default Document is inserted at the top of the list.

Required Parameters

-Filter

Can be a configuration section, or an XPath query that returns either a configuration section or a configuration element that contains a collection.

Type:String[]
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-AtElement

The element in the collection location at which the value is inserted.

Type:Hashtable
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False
-AtIndex

The index at which the value is inserted.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False
-AtName

The name at which the value is inserted.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False
-Clr

Version of the .NET framework in the form vn.n, such as v4.0 or v2.0. The default is v4.0. This parameter is used only when PSPath is set to either Machine or Machine/Webroot. If PSPath is not set to one of these values and the Clr parameter is set, PowerShell ignores the value of Clr and returns a warning.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Force

Forces the creation of configuration, and overrides existing element settings.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Location

The location to which the configuration is written.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-PSPath

Specifies the configuration path. This can be either an IIS configuration path in the formatcomputer name/webroot/apphost, or the IIS module path in this format IIS:\sites\Default Web Site.

Type:String[]
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Value

The value to add to the configuration collection. This can be a single value or a value/key combination in a hash table.

Type:PSObject
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSObject

Outputs

PSObject