如何在C# 中使用WMI 实现远程查询和共享[5]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 smandhgx 的 blog

{   //连接远程计算机,我们要想对其进行操作,必须先连接上

    connectionoptions myconnect = new connectionoptions();

    myconnect.username = "zhangdong";

    myconnect.password = "1234";

  managementpath remotenamespace = new managementpath("\\\\servername\\root\\cimv2");  

managementscope myscope = new managementscope(remotenamespace,myconnect);

    //先连接上要引用的 wmi 类在这里我们引用 win32_share 类

managementpath sharepath = new managementpath("win32_share");

 

objectgetoptions otheroption =  new objectgetoptions(null,new

timespan(0,0,10) ,true);

managementclass _processclass = new managementclass(myscope, sharepath,

本文关键:C#,WMI,.NET
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top