「Windows Management Instrumentation」の版間の差分

削除された内容 追加された内容
m編集の要約なし
編集の要約なし
1行目:
'''Windows Management Instrumentation''' ('''WMI''') は、[[Windows Driver Model]]への拡張の一種で、システムの構成要素について情報収集と通知を行う[[オペレーティングシステム]] (OS) の[[インタフェース (情報技術)|インタフェース]]を提供する。WMI は[[Distributed Management Task Force]] (DMTF) の定めた [[Web-Based Enterprise Management]] (WBEM) と [[Common Information Model]] (CIM) 標準の[[マイクロソフト]]による実装である。
 
WMI により、[[Microsoft Windows|Windows]]を搭載した[[パーソナルコンピュータ]]や[[サーバ]]を[[VBScript]]や[[Windows PowerShell|PowerShell]]のような[[スクリプト言語]]で(ローカルでもリモートでも)管理できるようになる。WMIは[[Microsoft Windows Vista|Windows Vista]]、[[Microsoft Windows Server 2003|Windows Server 2003]]、[[Microsoft Windows XP|Windows XP]]、[[Microsoft Windows Millennium Edition|Windows Me]]、[[Microsoft Windows 2000|Windows 2000]]に最初から実装されている。[[Microsoft Windows 95|Windows 95]]および[[Microsoft Windows 98|Windows 98]] 向けのWMIはダウンロード可能である<ref name=WMIDownload>[http://www.microsoft.com/downloads/details.aspx?familyid=98a4c5ba-337b-4e92-8c18-a63847760ea5&displaylang=en WMI Redistributable for Windows 95 and Windows 98]</ref>。
 
また、マイクロソフトはWMIの[[キャラクタユーザインタフェース]]として '''Windows Management Instrumentation Command-line''' ('''WMIC''') を提供している<ref> [http://support.microsoft.com/kb/290216 Description of WMIC] </ref>。
 
== WMIの目的 ==
38行目:
 
== 例 ==
[[.NET Framework]]WMIのマネージラッパー (System.Management.dll) が用意されており[https://docs.microsoft.com/ja-jp/dotnet/api/system.management.managementclass System.Management.ManagementClass][[クラス (コンピュータ)|クラス]]がCIM管理クラスを表している。WMIクラスは、ディスクドライブなら[https://docs.microsoft.com/en-us/windows/desktop/cimwin32prov/win32-logicaldisk Win32_LogicalDisk]、Notepad.exeのような実行中プログラムなら[https://docs.microsoft.com/en-us/windows/desktop/cimwin32prov/win32-process Win32_Process]となる。
 
以下の例は、"MSNdis_80211_ServiceSetIdentifier" を使って、システムが現在接続している[[Wi-Fi]]ネットワークの[[SSID]]を探す[[C Sharp|C#]]プログラムの[[ソースコード|コード]]である。
 
<source lang="csharp">
ManagementClass mc = new
ManagementClass mc = new ManagementClass("root\\WMI", "MSNdis_80211_ServiceSetIdentifier", null);
ManagementObjectCollection moc = mc.GetInstances();
null);
 
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
foreach (ManagementObject mo in moc)
{
string wlanCard = (string)mo["InstanceName"];
bool active = (bool)mo["Active"];
byte[] ssid = (byte[])mo["Ndis80211SsId"];
}
</source>
 
== 参考文献 ==