Edit

Share via


Get-IISConfigElement

Gets a configuration element object from an IIS configuration section or a configuration element.

Syntax

Default (Default)

Get-IISConfigElement
    [-ConfigElement] <ConfigurationElement>
    [[-ChildElementName] <String>]
    [<CommonParameters>]

Description

The Get-IISConfigElement cmdlet gets a child ConfigurationElement object from either a ConfigurationSection or a ConfigurationElement.

Examples

Example 1: Get a configuration element for an IIS website

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:\> Get-IISConfigAttributeValue -ConfigElement $Elem -AttributeName "MaxUrlSegments"

This command returns the configuration element limits for the Default Web Site into the Windows PowerShell variable $Elem.

Parameters

-ChildElementName

Specifies the name of the child ConfigurationElement to be returned. If this parameter is omitted, all the child elements for the given parent are returned.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:False
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 child ConfigurationElement is returned.

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