Remove-CMResource

Removes a resource.

Syntax

Remove-CMResource
      [-InputObject] <IResultObject>
      [-Force]
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMResource
      [-ResourceId] <Int32>
      [-Force]
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-CMResource cmdlet removes a resource. A resource can be a user or a device.

Examples

Example 1: Remove a resource by using the pipeline

PS C:\> Get-CMResource -ResourceID 2063597568 -Fast| Remove-CMResource -Force

This command gets the resource object with the ID of 2063597568 and uses the pipeline operator to pass the object to Remove-CMResource, which removes the resource without prompting for user confirmation.

Example 2: Remove a resource by ID

PS C:\> Remove-CMResource -ResourceID 2097152000

This command removes the resource with the ID of 2097152000.

Required Parameters

-InputObject

Specifies a resource object. To obtain a resource object, use the Get-CMResource cmdlet.

Type:IResultObject
Aliases:Resource
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ResourceId

Specifies the ID of a resource.

Type:Int32
Position:0
Default value:None
Accept pipeline input:False
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
-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
-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