Remove-CMResource

Removes a resource.

Syntax

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

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
Required:True
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ResourceId

Specifies the ID of a resource.

Type:Int32
Required:True
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
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-DisableWildcardHandling

Indicates that wildcard handling is disabled.

Type:SwitchParameter
Required:False
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
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ForceWildcardHandling

Indicates that wildcard handling is enabled.

Type:SwitchParameter
Required:False
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
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False