日期:2014-05-18 浏览次数:21161 次
using System;
using System.Management;
class Sample_ConnectionOptions
{
public static int Main(string[] args) {
ConnectionOptions options = new ConnectionOptions();
options.Username = 用户名; //could be in domain\user format
options.Password = 密码;
ManagementScope scope = new ManagementScope(
"\\\\servername\\root\\cimv2",
options);
try {
scope.Connect();
ManagementObject disk = new ManagementObject(
scope,
new ManagementPath("Win32_logicaldisk='c:'"),
null);
disk.Get();
}
catch (Exception e) {
Console.WriteLine("Failed to connect: " + e.Message);
}
return 0;
}
}
------解决方案--------------------
学习了
------解决方案--------------------
这个不会,帮你顶一下。
------解决方案--------------------
既然知道用户名密码,用NET USE吧
http://blog.csdn.net/lovefootball/archive/2008/08/25/2827139.aspx
------解决方案--------------------
MARK~