Lock-CMObject

Locks global objects in Configuration Manager.

Syntax

Lock-CMObject
    [-InputObject] <IResultObject[]>
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Lock-CMObject cmdlet acquires locks of one or more objects in Microsoft System Center Configuration Manager. You can use the InputObject parameter to specify the input to this cmdlet, or you can pipe the input to this cmdlet. When you obtain the lock, the lock is assigned to you, your computer and the site in which the computer resides. While the lock is assigned to you, no other user or computer can edit the object until you release the lock.

Important: Configuration Manager cmdlets now automatically handle the locking and unlocking of objects. Therefore, we do not recommend you use this cmdlet to lock objects because this may interfere with the functionality of the cmdlets.

Examples

Example 1: Lock a global object

PS C:\> $CIObj = Get-CMDriverPackage -Id "CM100042"
PS C:\> Lock-CMObject -InputObject $CIObj

The first command gets the driver package object that has the ID CM100042, and stores the object in the $CIObj variable.

The second command locks the object stored in $CIObj.

Required Parameters

-InputObject

Specifies an array of Configuration Manager objects output from another cmdlet.

Type:IResultObject[]
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

Optional Parameters

-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
-DisableWildcardHandling

DisableWildcardHandling treats wildcard characters as literal character values. Cannot be combined with ForceWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ForceWildcardHandling

ForceWildcardHandling processes wildcard characters and may lead to unexpected behavior (not recommended). Cannot be combined with DisableWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
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