Add-WebConfiguration

Add-WebConfiguration

Adds a collection element to an IIS configuration collection.

Syntax

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

Detailed Description

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

Parameters

-Value <PSObject>

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

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

named

-AtElement <Hashtable>

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

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Position?

named

-AtIndex <Int32>

The index at which the value is inserted.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Position?

named

-AtName <String>

The name at which the value is inserted.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Position?

named

-Force <SwitchParameter>

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

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

named

-Location <String[]>

The location to which the configuration is written.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByPropertyName)

Position?

named

-Filter <String[]>

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

Attributes

Name Value

Required?

true

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByPropertyName)

Position?

1

-PSPath <String[]>

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

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByPropertyName)

Position?

2

-WarningAction <ActionPreference>

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

named

-WarningVariable <String>

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

named

-WhatIf <SwitchParameter>

Describes what would happen if you executed the command without actually executing the command.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

named

-Confirm <SwitchParameter>

Prompts you for confirmation before executing the command.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

named

-CommonParameter

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see About Common Parameter

Input and Return Types

The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet emits.

Input Type

PSObject.

Return Type

PSObject.

Notes

Examples

EXAMPLE 1: Adding 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.

See Also

Reference

Add-WebConfigurationProperty
Remove-WebConfiguration
Set-WebConfiguration