Clear-WebConfiguration
Clear-WebConfiguration
Removes configuration settings from the specified configuration location.
Syntax
Clear-WebConfiguration [-Force] [-Location <String[]>] [-Filter] <String[]> [[-PSPath] <String[]>] [-WarningAction <ActionPreference>] [-WarningVariable <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Detailed Description
Removes configuration settings from the specified configuration location.
Parameters
-Force <SwitchParameter>
Forces the specified configuration to be cleared.
Attributes
Name | Value |
---|---|
Required? |
false |
Accept wildcard characters? |
false |
Accept Pipeline Input? |
false |
Position? |
named |
-Location <String[]>
The location of the configuration setting to clear. Location tags are frequently used for configuration settings that must be set more precisely than per application or per virtual directory. For example, a setting for a particular file or directory could use a location tag. Location tags are also used if a particular section is locked. In such an instance, the configuration system would have to use a location tag in one of the parent configuration files.
Attributes
Name | Value |
---|---|
Required? |
false |
Accept wildcard characters? |
false |
Accept Pipeline Input? |
true (ByPropertyName) |
Position? |
named |
-Filter <String[]>
Specifies the IIS configuration section or an XPath query that returns a configuration element.
Attributes
Name | Value |
---|---|
Required? |
true |
Accept wildcard characters? |
false |
Accept Pipeline Input? |
true (ByPropertyName) |
Position? |
1 |
-PSPath <String[]>
Specifies the configuration path. This can be either an IIS configuration path in the format computer name/webroot/apphost, or the IIS module path in this format IIS:\sites\Default Web Site.
Attributes
Name | Value |
---|---|
Required? |
false |
Accept wildcard characters? |
false |
Accept Pipeline Input? |
true (ByPropertyName) |
Position? |
2 |
-WarningAction <ActionPreference>
Attributes
Name | Value |
---|---|
Required? |
false |
Accept wildcard characters? |
false |
Accept Pipeline Input? |
false |
Position? |
named |
-WarningVariable <String>
Attributes
Name | Value |
---|---|
Required? |
false |
Accept wildcard characters? |
false |
Accept Pipeline Input? |
false |
Position? |
named |
-WhatIf <SwitchParameter>
Describes what would happen if you executed the command without actually executing the command.
Attributes
Name | Value |
---|---|
Required? |
false |
Accept wildcard characters? |
false |
Accept Pipeline Input? |
false |
Position? |
named |
-Confirm <SwitchParameter>
Prompts you for confirmation before executing the command.
Attributes
Name | Value |
---|---|
Required? |
false |
Accept wildcard characters? |
false |
Accept Pipeline Input? |
false |
Position? |
named |
-CommonParameter
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see About Common Parameter
Input and Return Types
The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet emits.
Input Type |
. |
Return Type |
. |
Notes
Examples
EXAMPLE 1: Removing ASP configuration on the root node
C:\PS>Clear-WebConfiguration -Filter /system.webServer/asp -PSPath 'IIS:\'
This command removes the <asp> section from the root node.
EXAMPLE 2: Remove a configuration property from the root node
C:\PS>Clear-WebConfiguration -Filter /system.webServer/asp/@lcid -PSPath 'IIS:\'
This example removes the lcid property from the IIS configuration root node.
EXAMPLE 3: Removing configuration from the site node
IIS:\>Clear-WebConfiguration -Filter /system.webServer/asp -PSPath 'IIS:\sites\Default Web Site'
Remove the <asp> section from the IIS configuration node for the Default Web Site.