#navi(../)

* WMIオブジェクトの見つけ方・Get-WmiObject [#hc51cf8d]
PowerShellでWMIオブジェクトの見つけ方を以下に記します。

#contents
#htmlinsertpcsp(win-top.html,win-sp.html)

* Get-WmiObjectコマンドレットを使用して検索する [#n7b395e3]
Get-WmiObjectを使用することにより、WMIオブジェクトの一覧を表示することができます。~
書式は以下の通りです。
 Get-WmiObject -list
以下は実際にGet-WmiObject -listを実行した時の出力です。
 PS C:\Users\sakura> Get-WmiObject -list
 
 
    NameSpace: ROOT\cimv2
 
 Name                                Methods              Properties
 ----                                -------              ----------
 CIM_Indication                      {}                   {CorrelatedIndications, IndicationFilterName, IndicationIde...
 CIM_ClassIndication                 {}                   {ClassDefinition, CorrelatedIndications, IndicationFilterNa...
 CIM_ClassDeletion                   {}                   {ClassDefinition, CorrelatedIndications, IndicationFilterNa...
 CIM_ClassCreation                   {}                   {ClassDefinition, CorrelatedIndications, IndicationFilterNa...
 CIM_ClassModification               {}                   {ClassDefinition, CorrelatedIndications, IndicationFilterNa...
 CIM_InstIndication                  {}                   {CorrelatedIndications, IndicationFilterName, IndicationIde...
 CIM_InstCreation                    {}                   {CorrelatedIndications, IndicationFilterName, IndicationIde...
 CIM_InstModification                {}                   {CorrelatedIndications, IndicationFilterName, IndicationIde...
 CIM_InstDeletion                    {}                   {CorrelatedIndications, IndicationFilterName, IndicationIde...
 <省略>

以下の書式でWMIオブジェクトを検索することができます。
 Get-WmiObject -list | Select-String キーワード

実際に検索した例を以下に記します。
 PS C:\Users\sakura> Get-WmiObject -list | Select-String Win32_Processor
 
 \\コンピュータ名\ROOT\cimv2:Win32_Processor

* 検索したオブジェクトの内容を確認する方法 [#s998eed9]
Get-WmiObjectコマンドを使用することによりオブジェクトの内容を確認することができます。
 Get-WmiObject オブジェクト名

実際にGet-WmiObjectコマンドを利用して確認してみます。
 PS C:\Users\sakura> Get-WmiObject Win32_Processor
 
 
 Caption           : x86 Family 6 Model 53 Stepping 1
 DeviceID          : CPU0
 Manufacturer      : GenuineIntel
 MaxClockSpeed     : 1800
 Name              : Intel(R) Atom(TM) CPU Z2760  @ 1.80GHz
 SocketDesignation : U2H1

上記のようにWin32_Processorを指定することによりプロセッサの情報を表示することができます。~
以下のようにすれば特定のプロパティ値を表示することができます。
 PS C:\Users\sakura> (Get-WmiObject Win32_Processor).Name
 Intel(R) Atom(TM) CPU Z2760  @ 1.80GHz

以上、Get-WmiObjectコマンドレットを使用してWMIオブジェクトを参照する方法でした。

#htmlinsertpcsp(win-btm.html,win-sp.html)

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS