Update-SCSMClassInstance
Update-SCSMClassInstance
Updates property values of a class instance.
Syntax
Parameter Set: Default
Update-SCSMClassInstance [-Instance] <EnterpriseManagementInstance[]> [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Update-SCSMClassInstance cmdlet updates property values of a class instance.
Parameters
-Instance<EnterpriseManagementInstance[]>
Specifies an instance of a class to update.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
Required? |
false |
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.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance
You can pipe a class instance to the Instance parameter of the Update-SCSMClassInstance cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
EnterpriseManagementInstance
This cmdlet generates an EnterpriseManagementInstance object when the
PassThru
parameter is used.
Examples
Example 1: Mark class instances for deletion
This command updates all configuration item instances of class System.Printer to mark them for deletion.
PS C:\> Get-SCSMClassInstance (Get-SCSMClass –Name "System.Printer") | %{ $_.ObjectStatus = ”pending delete” ; $_ } | Update-SCSMClassinstance
Example 2: Change the location value of a Service Manager configuration item instance
This commands changes 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
PS C:\>Get-SCSMClassInstance -Class (Get-SCSMClass "Microsoft.Ad.Printer") -Filter 'Location -eq "Seattle"'| %{ $_.Location = "Portland"; $_ } | Update-SCSMInstance Get-SCSMObject -ClassName "Microsoft.Ad.Printer"