作者spentun (Green Island)
看板C_Sharp
标题[问题] 一个 WMI 的问题
时间Wed Aug 3 21:11:03 2005
我在网路上看到一个范例
它是用 WMI 来取得电脑的一些资讯 :比如硬碟 size 等等
我的的问题是 它只能抓到自己 localhost 端的资料
请问如果要自己指定 抓某台 IP 的资讯 该怎麽做呢
谢谢
网路范例如下
//Connection credentials to the remote computer -
//not needed if the logged in account has access
ConnectionOptions oConn = new ConnectionOptions();
//oConn.Username = "usename";
//oConn.Password = "password";
System.Management.ManagementScope oMs =
new System.Management.ManagementScope("\\\\localhost", oConn);
//get Fixed disk stats
System.Management.ObjectQuery oQuery =
new System.Management.ObjectQuery("select FreeSpace,Size,Name from Win32_LogicalDisk where DriveType=3");
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs,oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();
-----------------------------------------------------------------------
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.118.155.66
1F:推 EricTsai:localhost就是电脑名称啊 140.113.91.10 08/04