I have tried two ways to do this so far.
The first way, I used System.Diagnostics , but I got a NotSupportedException from the "Feature is not supported for remote machines" on MainModule .
foreach (Process runningProcess in Process.GetProcesses(server.Name)) { Console.WriteLine(runningProcess.MainModule.FileVersionInfo.FileDescription); }
Secondly, I tried to use System.Management , but it seems that Description for ManagementObject is the same as Name .
string scope = @"\\" + server.Name + @"\root\cimv2"; string query = "select * from Win32_Process"; ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query); ManagementObjectCollection collection = searcher.Get(); foreach (ManagementObject obj in collection) { Console.WriteLine(obj["Name"].ToString()); Console.WriteLine(obj["Description"].ToString()); }
Does anyone possibly find out about a more efficient way to get descriptions of a running process on a remote machine?
c # process wmi remote-access
athom
source share