Link to home
Create AccountLog in
Avatar of fantamen
fantamenFlag for Italy

asked on

Get running applications in a terminal server

Application A is started from a terminal server session.
When I start application A I've to check if application B and C are already running.
My problem is that the two applications are started from other sessions in the same terminal server.
Is there a class in the .net framework that can help me to get if app B, C are running?



Thank you!
Avatar of Beartlaoi
Beartlaoi
Flag of United States of America image

Have you tried System.Diagnostics.Process.GetProcessesByName?
Of course if your Application A is running under restrictions this may not work.
If you are the developer for apps B and C then you can use System.Threading.Mutex using a name like Global\MyAppB to not only make sure that only one instance of App B runs but also allows other apps to check to see if App B is running.
Avatar of fantamen

ASKER

System.Diagnostics.Process.GetProcessesByName see the same process of Windows Task Manager?
I ask you this question because Task Manager show only the task of the user session, not the process of other users sessions opened by other terminal server users.



Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Beartlaoi
Beartlaoi
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Thank you very much Beartlaoi!