Edit

Share via


Get-IISConfigAttributeValue

Gets a configuration attribute value from an IIS configuration section or configuration element attribute.

Syntax

Default (Default)

Get-IISConfigAttributeValue
    [-ConfigElement] <ConfigurationElement>
    [-AttributeName] <String>
    [<CommonParameters>]

Description

The Get-IISConfigAttributeValue cmdlet gets a configuration attribute value from an Internet Information Services (IIS) configuration section attribute or a configuration element attribute. The value returned is the value that can be extracted from the given ConfigurationElement and not necessarily the effective value for a given site / virtual directory / folder etc. To obtain the effective attribute values, always retrieve the configuration element by specifying the commit path as the deepest level possible. Even the configuration attribute is not defined at that level, the parent attributes are scanned and the effective configuration element is returned. You can then work on this ConfigurationElement to get/set/remove configuration attribute values.

Examples

Example 1: Get a configuration attribute from an IIS website

PS C:\> Get-IISSite "Default Web Site" | Get-IISConfigElement -ChildElementName "limits" | Get-IISConfigAttributeValue -AttributeName "MaxUrlSegments"

This command gets the configuration attribute MaxUrlSegments for the Default Web Site.

Example 2: Get configuration attribute values from different parts of the configuration store

PS C:\> Get-IISConfigSection "system.webServer/asp" | Get-IISConfigAttributeValue -AttributeName "ScriptErrorMessage"
An error occurred on the server when processing the URL. Please contact the system administrator. <p/> If you are the system administrator please click <a href="https://go.microsoft.com/fwlink/?LinkID=82731">here</a> to find out more about this error.

This command gets the global attribute value for ScriptErrorMessage

Parameters

-AttributeName

Specifies the name of the attribute that will be retrieved.

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

-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.

Inputs

ConfigurationElement

String

Outputs

Object