Get-IISConfig Element

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

Syntax

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.

Required Parameters

-ConfigElement

Specifies the IIS ConfigurationSection or ConfigurationElement for which the child ConfigurationElement is returned.

Type: ConfigurationElement
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

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

Type: String
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

Inputs

Microsoft.Web.Administration.ConfigurationElement, System.String

Outputs

Microsoft.Web.Administration.ConfigurationElement