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
Specifies that the class instance should be 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 --------------------------
The following example shows how to update all configuration item instances of class ‘Disk’ so that they are marked for deletion.
PS C:\> Get-SCClassInstance (get-SCSMClass –Name System.Printer) | %{ $_.ObjectStatus = ”pending delete” ; $_ } | update-SCClassinstance
-------------------------- EXAMPLE 2 --------------------------
The commands in this example change the location value of a Service Manager configuration item instance.
PS C:\>Get-SCClassInstance -class (get-SCClass -name microsoft.ad.printer) -filter 'Location -eq "Seattle"'|format-table UNCName,PrinterName,Description,Location
PS C:\>Get-SCClassInstance -class (Get-SCClass microsoft.ad.printer) -filter 'Location -eq "Seattle"'| %{ $_.Location = "Portland"; $_ } | Update-SCSMInstance Get-SCSMObject -classname microsoft.ad.printer