代碼如下
using System;
using System
using System
using System
using System
using System
using System
using System
namespace Ex
{
public partial class Form
{
public Form
{
InitializeComponent();
}
private void button
{
//指定生成 WMI 連接所需的所有設置
ConnectionOptions op = new ConnectionOptions();
op
//遠程計算機用戶名稱
op
//遠程計算機用戶密碼
//設置操作管理范圍
ManagementScope scope = new ManagementScope(
scope
//將此 ManagementScope 連接到實際的 WMI 范圍
ObjectQuery oq = new ObjectQuery(
ManagementObjectSearcher query = new ManagementObjectSearcher(scope
//得到WMI控制
ManagementObjectCollection queryCollection = query
foreach (ManagementObject obj in queryCollection)
{
obj
}
}
}
}
From:http://tw.wingwit.com/Article/program/net/201311/13762.html