|
- ConnectionOptions options = new ConnectionOptions();
- options.Username = UserName;
- options.Password = Password;
- options.Authority = "ntlmdomain:FAREAST";
- ManagementScope scope = new ManagementScope(@"\\" + machinename + @"\root\cimv2", options);
- scope.Connect();
- ObjectQuery query = new ObjectQuery("select * from Win32_LogicalDisk");
- ManagementObjectSearcher searcher =
- new ManagementObjectSearcher(scope, query);
- ManagementObjectCollection queryCollection = searcher.Get();
- foreach (ManagementObject nic in queryCollection)
- {
- foreach (PropertyData property in nic.Properties)
- Console.WriteLine(property.Name + "\t\t" + property.Value);
- }
复制代码
|
|