Share via


Remove-SCClassInstance

Removes a class instance.

Syntax

Default (Default)

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

Description

The Remove-SCClassInstance cmdlet permanently removes a class instance.

Examples

Example 1: Remove all class instances of a specific type

PS C:\>$Cmp = Get-SCClass -Name Microsoft.Windows.Computer
PS C:\>Get-SCClassInstance -Class $Cmp -Filter 'DisplayName -like "Computer1%"' | Remove-SCClassInstance
PS C:\>Get-SCClassInstance -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.

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Instance

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

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

Parameter properties

Type:

Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance

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

Outputs

None.

This cmdlet does not generate any output.