편집

다음을 통해 공유


Clear-IISConfigCollection

Clears an IIS configuration collection.

Syntax

Clear-IISConfigCollection
     [-ConfigCollection] <ConfigurationElementCollection>
     [-WhatIf]
     [-Confirm]
     [<CommonParameters>]

Description

The Clear-IISConfigCollection cmdlet clears a given Internet Information Services (IIS) collection by removing all the elements and putting a clear tag, which is generally <clear>. This prevents from the collection to inherit collection elements from higher levels, if any.

Examples

Example 1: Clear the defaultDocument settings for Default Web Site, which inherits from Server level and defined in applicationHost.config.

PS C:\> Get-IISConfigSection -SectionPath "system.webServer/defaultDocument" -CommitPath "Default Web Site" | Get-IISConfigCollection -CollectionName "files" | Clear-IISConfigCollection -Confirm:$False

This command adds lines in web.config which is the configuration file of Default Web Site.

Parameters

-ConfigCollection

Specifies the ConfigurationCollection object for which the collection elements will be cleared. If a ConfigurationCollection is previously obtained and assigned to a variable, you cannot pass it to this cmdlet through the pipeline because the pipeline engine will try to enumerate, passing ConfigurationElement objects instead. Try either passing the whole Get-IISConfigCollection cmdlet into the pipeline or use it as a parameter for correct results.

Type:ConfigurationElementCollection
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required: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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

ConfigurationElementCollection

Outputs

Object