Set-IISConfig
Attribute
Value
Syntax
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.
Required Parameters
Specifies the name of the attribute for which the value will be set.
Type: | String |
Position: | 2 |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Specifies the new value of the attribute.
Type: | Object |
Position: | 3 |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Specifies the IIS ConfigurationSection or ConfigurationElement for which the attribute value will be looked up.
Type: | ConfigurationElement |
Position: | 1 |
Default value: | None |
Accept pipeline input: | True (ByPropertyName, ByValue) |
Accept wildcard characters: | False |
Inputs
Microsoft.Web.Administration.ConfigurationElement, System.String, System.Object