Remove-CMDeviceCollectionVariable

Removes a device collection variable.

Syntax

Remove-CMDeviceCollectionVariable
      -Collection <IResultObject>
      -VariableName <String>
      [-Force]
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMDeviceCollectionVariable
      -CollectionId <String>
      -VariableName <String>
      [-Force]
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMDeviceCollectionVariable
      -CollectionName <String>
      -VariableName <String>
      [-Force]
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-CMDeviceCollectionVariable cmdlet removes a device collection variable.

Examples

Example 1: Remove a device collection variable

PS C:\> $Collection = Get-CMCollection -Name "Device" 
PS C:\> Remove-CMDeviceCollectionVariable -Collection $Collection -VariableName "testTS" -Force

The first command gets the device collection object named Device and stores the object in the $Collection variable.

The second command removes the device collection variable named testTS from the device collection stored in $Collection. Specifying the Force parameter indicates that the user is not prompted before the variable is removed.

Example 2: Remove a device collection variable by using the pipeline

PS C:\> Get-CMCollection -Name "Device" | Remove-CMDeviceCollectionVariable -VariableName "testTS" -Force

This command gets the device collection object named Device and uses the pipeline operator to pass the object to Remove-CMDeviceCollectionVariable, which removes the device collection variable named testTS from the device collection object. Specifying the Force parameter indicates that the user is not prompted before the variable is removed.

Parameters

-Collection

Specifies a device collection object. To obtain a collection object, use the Get-CMCollection cmdlet.

Type:IResultObject
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-CollectionId

Specifies the ID of a device collection.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-CollectionName

Specifies the name of a device collection.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
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
-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
-Force

Forces the command to run without asking for user confirmation.

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

Specifies the name of a collection variable.

Type:String
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