Edit

Share via


Get-IISConfigCollection

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

Syntax

Default (Default)

Get-IISConfigCollection
    [-ConfigElement] <ConfigurationElement>
    [[-CollectionName] <String>]
    [<CommonParameters>]

Description

The Get-IISConfigCollection cmdlet gets a ConfigurationCollection object from either a ConfigurationSection or a ConfigurationElement.

It is advisable to not to assign this value to a parameter and pass it in the pipeline to the next cmdlet since Windows PowerShell cannot interpret this object. This is due to the fact that ConfigurationCollection implements IEnumerable and the pipeline processor enumerates each single element when used this way. Instead either pass the whole Get-IISConfigCollection cmdlet in the pipeline or pass it as a parameter.

Examples

Example 1: Get a configuration collection from an IIS configuration element

PS C:\> Get-IISConfigSection -SectionPath "system.webServer/defaultDocument" | Get-IISConfigCollection -CollectionName "files"

Attributes      : {value}
ChildElements   : {}
ElementTagName  : add
IsLocallyStored : True
Methods         :
RawAttributes   : {[value, Default.htm]}
Schema          : Microsoft.Web.Administration.ConfigurationElementSchema

Attributes      : {value}
ChildElements   : {}
ElementTagName  : add
IsLocallyStored : True
Methods         :
RawAttributes   : {[value, Default.asp]}
Schema          : Microsoft.Web.Administration.ConfigurationElementSchema

This command gets the Files Collection for the system.webServer/defaultDocument section.

Example 2: Get a configuration element from an IIS configuration section

PS C:\> Get-IISConfigSection -SectionPath "system.webServer/defaultDocument" | Get-IISConfigElement -ChildElementName "files" | Get-IISConfigCollection


Attributes      : {value}
ChildElements   : {}
ElementTagName  : add
IsLocallyStored : True
Methods         :
RawAttributes   : {[value, Default.htm]}
Schema          : Microsoft.Web.Administration.ConfigurationElementSchema

Attributes      : {value}
ChildElements   : {}
ElementTagName  : add
IsLocallyStored : True
Methods         :
RawAttributes   : {[value, Default.asp]}
Schema          : Microsoft.Web.Administration.ConfigurationElementSchema

This command gets the Files Element configuration object from the system.webServer/defaultDocument section then gets its default collection. The output of the two formats are the same.

Parameters

-CollectionName

Specifies the name of the collection to be returned. If the name of the collection is not used, the Default Collection is returned. Alternatively, the named collection can be retrieved by Get-IISConfigElement then the default collection inside this element can be retrieved.

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