次の方法で共有


Update-SCSMClassInstance

クラス インスタンスのプロパティ値を更新します。

構文

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

説明

Update-SCSMClassInstance コマンドレットは、クラス インスタンスのプロパティ値を更新します。

例 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

コマンドレットを実行する前に確認を求めるメッセージが表示されます。

型:System.Management.Automation.SwitchParameter
Aliases:cf
配置:Named
規定値:False
必須:False
パイプライン入力を受け取る:False
ワイルドカード文字を受け取る:False

-Instance

更新するクラスのインスタンスを指定します。

型:Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance[]
配置:1
規定値:None
必須:True
パイプライン入力を受け取る:True
ワイルドカード文字を受け取る:False

-PassThru

更新が完了した後、クラス インスタンスが現在の Windows PowerShell セッションに返されることを示します。 この出力オブジェクトは、他のコマンドレットに渡すことができます。

型:System.Management.Automation.SwitchParameter
配置:Named
規定値:None
必須:False
パイプライン入力を受け取る:False
ワイルドカード文字を受け取る:False

-WhatIf

コマンドレットを実行した場合の動作を示します。 コマンドレットは実行されません。

型:SwitchParameterSystem.Management.Automation.SwitchParameter
Aliases:wi
配置:Named
規定値:False
必須:False
パイプライン入力を受け取る:False
ワイルドカード文字を受け取る:False

入力

Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance

クラス インスタンスを、Update-SCSMClassInstance コマンドレットの Instance パラメーターにパイプできます。

出力

EnterpriseManagementInstance

このコマンドレットは、PassThru パラメーターを使用すると、EnterpriseManagementInstance オブジェクトを生成します。