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|Format-Table PrincipalName,DisplayName
PrincipalName                     DisplayName

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

CenSupport.contoso.com            CenSupport$

Computer1.contoso.com             Computer1.contoso.com

WIN-752HJBSX24M.contoso.com



PS C:\>Get-SCSMClassInstance -Class $Cmp -Filter 'DisplayName -Like "C%"'
PrincipalName                     DisplayName

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

Computer1.contoso.com             Computer1.contoso.com



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 class begins with the letter C.

Required Parameters

-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:EnterpriseManagementInstance[]
Position:1
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
-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

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.