Update-SCSMClassInstance

Updates property values of a class instance.

Syntax

Update-SCSMClassInstance
      [-Instance] <EnterpriseManagementInstance[]>
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Update-SCSMClassInstance cmdlet updates property values of a class instance.

Examples

Example 1: Mark class instances for deletion

PS C:\>Get-SCSMClassInstance (Get-SCSMClass -Name "System.Printer") | % { $_.ObjectStatus = "pending delete"; $_ } | Update-SCSMClassinstance

This command updates all configuration item instances of class System.Printer to mark them for deletion.

Example 2: Change the location value of a Service Manager configuration item instance

PS C:\>Get-SCSMClassInstance -Class (Get-SCSMClass -Name "Microsoft.Ad.Printer") -Filter 'Location -eq "Seattle"' | Format-Table UNCName,PrinterName,Description,Location
UNCName                PrinterName Description Location
-------                ----------- ----------- --------
\\PrintServer\Printer4 Printer4                Seattle
\\PrintServer\Printer7 Printer7                Seattle
\\PrintServer\Printer1 Printer1                Seattle
\\PrintServer\Printer9 Printer9                Seattle
\\PrintServer\Printer6 Printer6                Seattle
\\PrintServer\Printer3 Printer3                Seattle
\\PrintServer\Printer2 Printer2                Seattle
\\PrintServer\Printer5 Printer5                Seattle
\\PrintServer\Printer0 Printer0                Seattle
\\PrintServer\Printer8 Printer8                Seattle


PS C:\>Get-SCSMClassInstance -Class (Get-SCSMClass -Name "Microsoft.Ad.Printer") -Filter 'Location -eq "Seattle"'| % { $_.Location = "Portland"; $_ } | Update-SCSMClassInstance
PS C:\>Get-SCSMClassInstance -Class (Get-SCSMClass -Name "Microsoft.Ad.Printer") -Filter 'Location -eq "Portland"' | Format-Table UNCName,PrinterName,Description,Location
UNCName                PrinterName Description Location
-------                ----------- ----------- --------
\\PrintServer\Printer4 Printer4                Portland
\\PrintServer\Printer7 Printer7                Portland
\\PrintServer\Printer1 Printer1                Portland
\\PrintServer\Printer9 Printer9                Portland
\\PrintServer\Printer6 Printer6                Portland
\\PrintServer\Printer3 Printer3                Portland
\\PrintServer\Printer2 Printer2                Portland
\\PrintServer\Printer5 Printer5                Portland
\\PrintServer\Printer0 Printer0                Portland
\\PrintServer\Printer8 Printer8                Portland

This commands changes the location value of a Service Manager configuration item instance.

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 class to update.

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

-PassThru

Indicates that the class instance is returned to the current Windows PowerShell session after the update is complete. This output object can then be passed to other cmdlets.

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

-WhatIf

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

Type:SwitchParameterSystem.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 Update-SCSMClassInstance cmdlet.

Outputs

EnterpriseManagementInstance

This cmdlet generates an EnterpriseManagementInstance object when the PassThru parameter is used.