process.GetProcessesByName getting error

  • Thread starter Thread starter hangten
  • Start date Start date
H

hangten

I have a service that 1) uses filewatcher to watch a directory on a
remote machine.
2) checks if a certain application is running on the local machine
before starting it.

The problem is while checking for an existing instance of the
application. I do the following code :
Process[] processes = Process.GetProcessesByName(stProcName, localcpu);
Where stProcName is the process I am checking
localcpu is the local machine name.

When it trys to execute this command it gives me an error stating that
it cannot get the process information from the remote machine. I'm not
sure why it is trying to look at the remote machine or how what is
telling it to look over there. The only thing that should be looking
over to the remote machine is FileSystemWatcher.
Thanks for any help
Carol
 
Why using the overload that takes a machine name? You know, that localcpu is
the local machine, but for the code any name for machineName is considered
remote.
Try using GetProcessesByName(stProcName); and you will get the same
exception, simply because the service has no sufficient rights to enumerate
all process.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top