Partager via


Set-WebConfigurationProperty

Set-WebConfigurationProperty

Changes the value of an IIS configuration property.

Syntax

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


Set-WebConfigurationProperty -Name <String> -InputObject <Object> [-AtElement <Hashtable>] [-AtIndex <Int32>] [-AtName <String>] [-Force] [-Location <String[]>] [-Filter] <String[]> [[-PSPath] <String[]>] [-WarningAction <ActionPreference>] [-WarningVariable <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

Detailed Description

The Set-WebConfigurationProperty cmdlet changes the value of an IIS configuration property. The element can be specified as a configuration section or an XPath query. Globbing, the use of wildcards, is supported.

Parameters

-Name <String>

The name of the configuration property to change.

Attributes

Name Value

Required?

true

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

named

-Value <PSObject>

The value of the configuration setting to change.

Attributes

Name Value

Required?

true

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

named

-AtElement <Hashtable>

The element at which the configuration property is set.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Position?

named

-AtIndex <Int32>

The index at which the configuration property is set.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Position?

named

-AtName <String>

The name of the collection property for which the value is set.

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Position?

named

-Force <SwitchParameter>

If the Force parameter is used it causes the configuration property 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: Change the extension of all handlers mapped to .aspx

IIS:\>Set-WebConfigurationProperty "//handlers/add[@path='*.aspx']" -PSPath IIS:\ -Name path –Value “*.mspx”

The cmdlet changes all handler paths to *.mspx that were mapped to *.aspx.

EXAMPLE 2: Setting new Bindings on an existing Web site

IIS:\>set-webconfigurationproperty '/system.applicationHost/sites/site[@name="DemoSite"]' -PSPath IIS:\ -Name Bindings -Value (@{protocol="http";bindingInformation=”*:80:DemoSite1”},@{protocol="http";bindingInformation="*:80:DemoSite2"})

The cmdlet sets new bindings on an existing Web site. The original bindings are replaced.