共用方式為


Update-SCSMClassInstance

更新類別實例的屬性值。

語法

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

Description

Update-SCSMClassInstance Cmdlet 會更新類別實例的屬性值。

範例

範例 1:標記要刪除的類別實例

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

此命令會更新 System.Printer 類別的所有組態項目實例,將其標示為要刪除。

範例 2:變更 Service Manager 組態項目實例的位置值

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

此命令會變更 Service Manager 組態項目實例的位置值。

參數

-Confirm

在執行 Cmdlet 之前,提示您進行確認。

類型:System.Management.Automation.SwitchParameter
別名:cf
Position:Named
預設值:False
必要:False
接受管線輸入:False
接受萬用字元:False

-Instance

指定要更新之類別的實例。

類型:Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance[]
Position:1
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-PassThru

指出類別實例會在更新完成之後傳回至目前的 Windows PowerShell 會話。 然後,這個輸出物件可以傳遞至其他 Cmdlet。

類型:System.Management.Automation.SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-WhatIf

顯示 Cmdlet 執行時會發生什麼事。 Cmdlet 未執行。

類型:SwitchParameterSystem.Management.Automation.SwitchParameter
別名:wi
Position:Named
預設值:False
必要:False
接受管線輸入:False
接受萬用字元:False

輸入

Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance

您可以使用管線將類別實例傳送至 Update-SCSMClassInstance Cmdlet 的 Instance 參數。

輸出

EnterpriseManagementInstance

使用 PassThru 參數時,此 Cmdlet 會產生 EnterpriseManagementInstance 物件。