Remove-IISConfigCollectionElement

Removes a configuration element object from an IIS configuration collection.

Syntax

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.

Required Parameters

-ConfigCollection

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

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

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

Type:Hashtable
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.Web.Administration.ConfigurationElementCollection, System.Collections.Hashtable