如下代码,传入IP,远程计算机本地用户的用户名和密码后,查询一切正常但是如果使用域用户 domain_test\administrator 这样的用户名传进去,就报错hresult 0x80070005这是为啥呢??
我的本地计算机和远程要查询的计算机都在同一个域中.... /// <summary>
/// 获取指定主机的内存信息
/// </summary>
/// <param name="ip">主机地址</param>
/// <param name="username">用户名</param>
/// <param name="password">用户密码</param>
/// <returns></returns>
public static ICollection<PhysicalMemory> GetPhysicalMemoryInfo(string ip, string username, string password)
{
ICollection<PhysicalMemory> PhysicalMemoryinfos = new List<PhysicalMemory>(); var queryCollection = GetQueryObject(ip, username, password, "Select * from Win32_PhysicalMemory");//获取内存查询 foreach (var mo in queryCollection)
{
PhysicalMemory PhysicalMemoryinfo = new PhysicalMemory();
foreach (var p in mo.Properties)
{
ClassManager.SetPropertyValue(PhysicalMemoryinfo, p.Name, p.Value != null ? p.Value.ToString() : "", null);
}
PhysicalMemoryinfos.Add(PhysicalMemoryinfo);
}
return PhysicalMemoryinfos;
}
我的本地计算机和远程要查询的计算机都在同一个域中.... /// <summary>
/// 获取指定主机的内存信息
/// </summary>
/// <param name="ip">主机地址</param>
/// <param name="username">用户名</param>
/// <param name="password">用户密码</param>
/// <returns></returns>
public static ICollection<PhysicalMemory> GetPhysicalMemoryInfo(string ip, string username, string password)
{
ICollection<PhysicalMemory> PhysicalMemoryinfos = new List<PhysicalMemory>(); var queryCollection = GetQueryObject(ip, username, password, "Select * from Win32_PhysicalMemory");//获取内存查询 foreach (var mo in queryCollection)
{
PhysicalMemory PhysicalMemoryinfo = new PhysicalMemory();
foreach (var p in mo.Properties)
{
ClassManager.SetPropertyValue(PhysicalMemoryinfo, p.Name, p.Value != null ? p.Value.ToString() : "", null);
}
PhysicalMemoryinfos.Add(PhysicalMemoryinfo);
}
return PhysicalMemoryinfos;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货