문제

By using Process.GetProcesses, we can list running processes in a remote computer, e.g.

Process [] allRemoteProcesses = Process.GetProcesses("myRemoteComputer");

However, this seems to depend on the permission of my account. It throws exception "Couldn't connect to remote machine." if the running user does not have access to the remote machine. Can I specify another account to be used by .NET when checking the processes, similar to the -u and -p switches in PsList?

도움이 되었습니까?

해결책

What I've done before is use something similar to what's described in this article.

using (new Impersonator("user", "domain", "pass"))
{
   Process[] allRemoteProcesses = Process.GetProcesses("myRemoteComputer");
   // Rest of code...
}

An alternative is use to use WMI and query for the processes like what's described here.

다른 팁

For the same problem, turning on the remote registry service in the remote registry worked for me!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top