Edit

Share via


Remove-IISConfigCollectionElement

Removes a configuration element object from an IIS configuration collection.

Syntax

Default (Default)

Remove-IISConfigCollectionElement
    [-ConfigCollection] <ConfigurationElementCollection>
    [[-ConfigAttribute] <Hashtable>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Remove-IISConfigCollectionElement cmdlet removes a ConfigurationElement from a given Internet Information Services (IIS) ConfigurationCollection.

Examples

Example 1: Remove a file name from the list of default documents

PS C:\> $ConfigSection = Get-IISConfigSection -SectionPath "system.webServer/defaultDocument"
PS C:\> Get-IISConfigCollection $ConfigSection "Files" | Remove-IISConfigCollectionElement  -ConfigAttribute @{"Value" = "MyDefDoc.htm"}

This command removes a configuration entry from the list of default documents.

Parameters

-ConfigAttribute

Specifies a hashtable of the attributes to match while searching for the configuration elements to delete in the collection. For the configuration attributes that are not specified, no filtering will be done. If you omit this parameter, all the elements in the collection are deleted.

Parameter properties

Type:Hashtable
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

-ConfigCollection

Specifies the ConfigurationCollection from which the matching ConfigurationElements will be removed.

Parameter properties

Type:ConfigurationElementCollection
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

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
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

ConfigurationElementCollection

Hashtable

Outputs

Object