可以使用WMI收集远程系统信息 [英] Can Collect Remote System information using WMI

查看:84
本文介绍了可以使用WMI收集远程系统信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可以使用C#中的WMI收集完整的远程系统信息.
问候,
Purnananda Behera.

Hi,
Can Collect complete remote system information using WMI in C#.

Regards,
Purnananda Behera.

推荐答案

^ ]!


是的,请尝试以下代码

Yes, Try the following code

ConnectionOptions connOpt = new ConnectionOptions();
connOpt .Username = "username";
connOpt .Password = "password";
ManagementScope mScope = new ManagementScope("\\\\yourIPOrMachineName\\root\\CIMV2", connOpt);
mScope.Connect();
ObjectQuery query = new ObjectQuery("Query");
//Replace above Query with required wmi query. 
ManagementObjectSearcher mOSearcher = new ManagementObjectSearcher(mScope, query);
ManagementObjectCollection oReturnCollection = mOSearcher.Get();
foreach (ManagementObject objInfo in oReturnCollection)
{
  // Fetch the required info from objInfo 
} 


这篇关于可以使用WMI收集远程系统信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆