在远程服务器上显示文件的版本 [英] displaying a version of file on a remote server
本文介绍了在远程服务器上显示文件的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须远程登录服务器并提取文件的版本.
Hi,
I have to remotely login in a server and extract a version of a file.
For remotely login I have tried by doing like this.But its throwing an ManagementException as "User credentials cannot be used for local connections".
static void Main(string[] args)
{
ConnectionOptions options = new ConnectionOptions();
options.Username = "ABC";
options.Password = "****";
ManagementScope scope = new ManagementScope(@"\\xxx.xx.xx.xxx, options);
scope.Connect();
//Query system for Operating System information
ObjectQuery query = new ObjectQuery(
"SELECT * FROM Win32_OperatingSystem");
ManagementObjectSearcher searcher =
new ManagementObjectSearcher(scope, query);
ManagementObjectCollection queryCollection = searcher.Get();
foreach (ManagementObject m in queryCollection)
{
// Display the remote computer information
Console.WriteLine("Computer Name : {0}",
m["csname"]);
Console.WriteLine("Windows Directory : {0}",
m["WindowsDirectory"]);
Console.WriteLine("Operating System: {0}",
m["Caption"]);
Console.WriteLine("Version: {0}", m["Version"]);
Console.WriteLine("Manufacturer : {0}",
m["Manufacturer"]);
}
}
In App.config
<?xml version="1.0" encoding="utf-8">
<configuration>
<system.web>
<identity impersonate="true" userName="ABC" password="****"
</system.web>
</configuration>
Kindly help me out.
推荐答案
修复链接
无法评估函数调用超时 [ ^ ]
80041064-用户凭据不能用于本地连接 [ ASP.NET WMI查询 [
Fix link
Function call could not be evaluated timed out[^]
80041064 - User credentials cannot be used for local connections[^]
ASP.NET WMI Query[^]
这篇关于在远程服务器上显示文件的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文