Remove-SCSMClassInstance

Removes a class instance.

Syntax

Remove-SCSMClassInstance
      [-Instance] <EnterpriseManagementInstance[]>
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-SCSMClassInstance cmdlet permanently removes a class instance.

Examples

Example 1: Remove all class instances of a specific type

PS C:\>$Cmp = Get-SCSMClass -Name Microsoft.Windows.Computer
PS C:\>Get-SCSMClassInstance -Class $Cmp -Filter 'DisplayName -like "Computer1%"' | Remove-SCSMClassInstance
PS C:\>Get-SCSMClassInstance -Class $Cmp|Format-Table PrincipalName,DisplayName
PrincipalName                     DisplayName

-------------                     -----------

CenSupport.contoso.com            CentSupport$

WIN-752HJBSX24M.woodgrove.com

These commands remove all class instances of type System.Windows.Computer when the instance DisplayName begins with the string Computer1.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:System.Management.Automation.SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Instance

Specifies an instance of a configuration item object to be removed.

You can specify an EnterpriseManagementObject that is returned by the Get-SCSMClassInstance cmdlet.

Type:Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance[]
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:System.Management.Automation.SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance

You can pipe a class instance to the Instance parameter of the Remove-SCSMClassInstance cmdlet.

Outputs

None.

This cmdlet does not generate any output.