简体   繁体   中英

Process Information on Remote Computer

I am writing a small program to retrieve list of services and processes running on a remote computer, all is running well. I am using Process for ret list of processes and ServiceController for list of services. Now is there anyway to get the size of the processes that are running on remote pc and actually find the size of the file associated with the process?

The tasklist and taskview functionality on command prompt could also aid in doing this. Your program could run cmd.exe in a process object and enter

tasklist /s remoteServer /u userName

as input, then listen to the output. It'll ask for a password for the account which should be provided as the next input. You could then listen for successive outputs till the EndOfOutput is reached.

Or if you have access to the remote computer, you could write a windows form program or console application hosting a WCF Service with a method that returns the list of running processes using Process.GetProcesses(), which would be executing on the remote computer. Using a service client in your program, you could call the remote method.

Any of the two above would work without having to use WMI, i guess.

To perform remote administration functions, usually, the right answer is to use WMI.

And using types in System.Management to interact with WMI from .NET. This page includes a simple example.

I would suggest using WMI for both remote and local information—avoiding two sets of code to maintain.

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