0

I am running a service program which is started multiple times with different configuration files passed on commandline. The program is started by a control program which is running as windows service. This service should be able to monitor and restart the programs. At the moment i have the problem if the control program crashes, i can not start all the instances of the service program, because i can not detect which instance is running and which is not running.

I tried using the System.Diagnostics.Process API and also the WMI API to get some information. But at both variants the Commandline arguments are NOT available.

To start an instance i am using the StartInfo-object of the System.Diagnostics.Process. I read somewhere at stackoverflow that the process information within the StartInfo object is not available to another process, but it should be available by the WMI API - but not in my case ..

Do i have to start the instances another way or exists another way to access the commandline arguments of a running process

mabunixda
  • 105
  • 7
  • Are these other programs under your control? Because there's no guarantee in windows that the command line you start a process with will survive the startup of that program (so would not be available) – Damien_The_Unbeliever Feb 11 '10 at 13:23
  • I usually use WMI to manage processes and its command line. – lsalamon Feb 11 '10 at 13:27
  • @Damien - yes that was may main problem .. but at 99% the commandline is readable at WMI queries. – mabunixda Feb 17 '10 at 09:47

1 Answers1

0

I changed this setup to use System.Management Namespace. Now the processes are listed detected. But i have to process the whole commandline using regular expressions .. that's the only "bad" thing about that

mabunixda
  • 105
  • 7