简体   繁体   English

使用WMI从远程计算机目录获取文件名

[英]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.

相关问题 使用 WMI 将文件从本地计算机复制到远程计算机 - Copy a file from local machine to remote machine using WMI 使用WMI在远程计算机上执行过程 - Execute a process in a remote machine using WMI 从另一台远程计算机上的共享启动远程计算机上的WMI进程 - Start process with WMI on remote machine from a share on another remote machine WMI重新启动远程计算机 - WMI to reboot remote machine 如何在没有WMI的.Net中获取远程机器操作系统版本? - How to get remote machine OS version in .Net, without WMI? 如何在没有 WMI 的情况下获取在远程计算机上运行的进程的所有者 - How to get owner of process running on remote machine without WMI ManagementEventWatcher(WMI)从远程计算机通知事件时发生异常 - Exception while ManagementEventWatcher(WMI) to notify events from remote machine 使用 WMI 监控远程机器上的带宽 - Monitoring Bandwith on a remote machine with WMI 从PowerShell或C#使用WMI-如何获得远程主机时间(包括毫秒)? - Using WMI from PowerShell or C# - how can I get remote host time, including milliseconds? 使用WMI或其他安全方法从远程服务器获取IIS设置(位于web.config中) - Get IIS settings (located in web.config) from remote server using WMI or other secure methods
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM