简体   繁体   中英

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.

Regards, M.Channabasappa

Do you have to use WMI, could you just do something like this?

    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);
        }
   }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM