[英]Get Filename from Remote machine directory using WMI
I want to get The name of a fle which lies in remote machines C\\Windows\\Name directory using WMI .or count the number of files in remote machine C\\Windows\\Name Directory using WMI. 我想使用WMI获取位于远程计算机C \\ Windows \\ Name目录中的文件名,或者使用WMI计算远程计算机C \\ Windows \\ Name目录中的文件数。
Regards, M.Channabasappa 尊敬的M.Channabasappa
Do you have to use WMI, could you just do something like this? 您是否必须使用WMI,是否可以做这样的事情?
var machines = new List<String>;
machines.Add("pc1");
machines.Add("pc1");
foreach (var machine in machines)
{
var dir = new System.IO.DirectoryInfo(string.Format("\\{0}\Windows\",machine));
foreach (var path in dir.GetDirectories)
{
Console.WriteLine(path);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.