0

I've been trying to determine if process A, that I installed, is already running on the machine. Process A requires admin priviliges, it is installed in C:\ProgramData and it is usually started as a service. There are many processes on the machine, that are named A. To find out, if this is my process, I inspected the path to exe file.

You can do this with process.MainModule.FileName or more elaborate setup that is documented in this question

Unfortunately, you cannot inspect the path of executable started as administrator without having administrator priviliges your self.

Is there another way to determine if the process with the name A is indeed the one you are looking for? What else can be checked beside path to executable? What workaround do you recommend?

UPDATE:

I misinterpreted the observations. If the process is started as a service, it is run as a SYSTEM user. Because of that, you cannot determine the executable path without having the admin priviliges your self.

Robert Segdewick
  • 543
  • 5
  • 17
  • Maybe this can help: https://stackoverflow.com/a/5479957/194717 https://winaero.com/blog/how-to-check-if-a-process-is-running-as-administrator-elevated-in-windows/ – Tony Mar 16 '20 at 11:44
  • 1
    If your long term plan is to communicate with the said process you will have to do Inter Process Communication (IPC) so you might just share this information between the applications. – Franck Mar 16 '20 at 11:53

0 Answers0