Set-WebConfiguration

Set-WebConfiguration

Sets the value of an IIS configuration element.

Syntax

Set-WebConfiguration -Value <PSObject> [-Metadata <String>] [-Force] [-Location <String[]>] [-Filter] <String[]> [[-PSPath] <String[]>] [-WarningAction <ActionPreference>] [-WarningVariable <String>] [-WhatIf] [-Confirm] [<CommonParameters>]


Set-WebConfiguration -InputObject <Object> [-Metadata <String>] [-Force] [-Location <String[]>] [-Filter] <String[]> [[-PSPath] <String[]>] [-WarningAction <ActionPreference>] [-WarningVariable <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

Detailed Description

The Set-WebConfiguration cmdlet changes the value of an IIS configuration element. The element can be specified as a configuration section or an XPath query.

Parameters

-Value <PSObject>

The value of the configuration setting to change.

Attributes

Name Value

Required?

true

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByPropertyName)

Position?

named

-Metadata <String>

If this parameter is specified, configuration metadata such as encryption or locking settings can be changed.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

named

-Force <SwitchParameter>

When the Force parameter is used, it causes the configuration setting to be set at a level in the configuration hierarchy above a lock in the configuration.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

named

-Location <String[]>

The location of the configuration setting. Location tags are frequently used for configuration settings that must be set more precisely than per application or per virtual directory. For example, a setting for a particular file or directory could use a location tag. Location tags are also used if a particular section is locked. In such an instance, the configuration system would have to use a location tag in one of the parent configuration files.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByPropertyName)

Position?

named

-Filter <String[]>

Specifies the IIS configuration section or an XPath query that returns a configuration element.

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 for confirmation before executing the command.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

named

-InputObject <Object>

Attributes

Name Value

Required?

true

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByValue, ByPropertyName)

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: Setting new Bindings on an existing Web site

IIS:\>Set-WebConfiguration -filter '/system.applicationHost/sites/site[@name=" DemoSite"]/bindings' -PSPath IIS:\ -value (@{protocol="http";bindingInformation=”*:80:DemoSite1”},@{protocol="http";bindingInformation="*:80:DemoSite2"})

The Set-WebConfiguration cmdlet is used to replace the existing bindings of the Web site named DemoSite with new bindings.