Windows Vista - Process.GetProcessesByName doesn't work
Hi,
This code is written in c#.net windows application.
I am trying to get all the processes by name using Process.GetProcessesByName("Exe Name") and for some reason this doesn't work in Windows Vista, does anyone have any idea?
What do you mean with that it doesn't work?
I did a quick test with C# express. I saw difference if the extension is included. Not sure if this is similar on XP, only have 1 computer.
Process[] arrP = Process.GetProcessesByName("explorer.exe"); // gives no items
arrP = Process.GetProcessesByName("explorer"); // gives one itemHere is the code that I tried,
Process[] allProcesses = Process.GetProcessesByName("Exe Name");
I throws an exception saying "Couldn't get process information from remote machine".
I get the following exception for a similar code:
Process[]arrProcess=Process.GetProcesses(strMachineName);
System.InvalidOperationException:Cannot open Service Control Manager on computer xyz. This operation might require other previliges. > System.ComponentModel.Win32Exception: Access is denied.
It works fine when I am monitoring an application on my local computer by giving its IP Address. But it does not work for remote computers. I believe It has something to do with user accounts and privileges on both machines but not sure how to go about them. Please help me! I have enabled remote administration on the computer that is being monitored.
I am having issues with Process.GetProcessesByName("Sierra") , the current software runs fine on XP but when I try to run it on Vista I get "Couldn't Get Process Information from Remote Machine" . The program is written in VB with VS2003. Any Ideas would be appreciated.
Thats the issue, I am running it from the local machine. It works under xp and it works under Vista if I turn off UAC, but not if UAC is enabled.
I found a solution.
On the Vista machine you have to start the "Remote Registry" service. Then you can get the processes from the Vista machine remotely. Otherwise it only works locally. Start the service and it works, stop the service and it doesn't. That simple.
I found the resolution at http://msdn2.microsoft.com/en-us/library/aa381831.aspx
which is instructions for getting the ITaskScheduler to work on Vista for scheduling tasks remotely. Fixing that corrected the Process.GetProcessesByName("exename", "vistapc") error I was getting.
Hope this helps,
Craig