Set-IISConfigAttributeValue
Sets a configuration attribute value for an IIS configuration section or configuration element attribute.
Syntax
Default (Default)
Set-IISConfigAttributeValue
[-ConfigElement] <ConfigurationElement>
[-AttributeName] <String>
[-AttributeValue] <Object>
[<CommonParameters>]
Description
The Set-IISConfigAttributeValue cmdlet sets a configuration attribute value from an Internet Information Services (IIS) configuration section attribute or a configuration element attribute. The value set is for the given ConfigurationElement and not necessarily the effective value for a given site / virtual directory / folder etc. To set the effective attribute values, always retrieve the configuration element by specifying the commit path as the deepest level possible.
Examples
Example 1: Set the value of a configuration attribute
PS C:\> $ConfigSection = Get-IISConfigSection -SectionPath "system.applicationHost/sites"
PS C:\> $SitesCollection = Get-IISConfigCollection -ConfigElement $ConfigSection
PS C:\> $Site = Get-IISConfigCollectionElement -ConfigCollection $SitesCollection -ConfigAttribute @{"name" = "Default Web Site"}
PS C:\> $Elem = Get-IISConfigElement -ConfigElement $Site -ChildElementName "limits"
PS C:\> Set-IISConfigAttributeValue -ConfigElement $Elem -AttributeName "MaxUrlSegments" -AttributeValue 16
This command sets the value of the configuration attribute MaxUrlSegments for the IIS website named Default Web Site to 16.
Parameters
-AttributeName
Specifies the name of the attribute for which the value will be set.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 2 |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-AttributeValue
Specifies the new value of the attribute.
Parameter properties
Type: | Object |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 3 |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-ConfigElement
Specifies the IIS ConfigurationSection or ConfigurationElement for which the attribute value will be looked up.
Parameter properties
Type: | ConfigurationElement |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 1 |
Mandatory: | True |
Value from pipeline: | True |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.