Edit

Share via


Add-WebConfigurationLock

Locks an IIS configuration section or element.

Syntax

Default (Default)

Add-WebConfigurationLock
    -Type <String>
    [-Force]
    [-Passthru]
    [-Location <String[]>]
    [-Filter] <String[]>
    [[-PSPath] <String[]>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Add-WebConfigurationLock cmdlet locks an Internet Information Services (IIS) configuration section, element, or attribute.

Examples

Example 1: Add and remove configuration locks

IIS:\> Add-WebConfigurationLock -Type "general" -Filter "//asp"
IIS:\> Remove-WebConfigurationLock -Filter "//asp"
IIS:\> Add-WebConfigurationLock -Type "inclusive" -Filter "//asp/@lcid"
IIS:\> Remove-WebConfigurationLock -Filter "//asp/@lcid"
IIS:\> Add-WebConfigurationLock -Type "exclusive" -Filter "//asp/@lcid"

This example demonstrates how to add and remove inclusive and exclusive locks using a filter.

Parameters

-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

-Filter

Specifies an XPath filter expression.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-Force

Forces the configuration lock.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-Location

Specifies the location at which this cmdlet applies the configuration lock.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-Passthru

Passes an object that represents the configuration lock to the pipeline.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-PSPath

Specifies the configuration path. This path can be either an IIS configuration path in the format computer name/webroot/apphost, or the IIS module path in the format IIS:\sites\Default Web Site.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-Type

Specifies the type of configuration lock that this cmdlet adds.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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