편집

다음을 통해 공유


Set-IISConfigAttributeValue

Sets a configuration attribute value for an IIS configuration section or configuration element attribute.

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.

Parameters

-AttributeName

Specifies the name of the attribute for which the value will be set.

Type:String
Position:2
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-AttributeValue

Specifies the new value of the attribute.

Type:Object
Position:3
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ConfigElement

Specifies the IIS ConfigurationSection or ConfigurationElement for which the attribute value will be looked up.

Type:ConfigurationElement
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

ConfigurationElement

String

Object

Outputs

Object