Click here to Skip to main content
11,641,668 members (57,539 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB Process Remote Desktop
I have developed an application that detects if it is already running using Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName) method.

But I have a customer with it installed on a Server 2003 that also hosts Remote Desktop connections. When these connections try to run the program they are told it is already running though naturally they have no access to it.

Is there a way of detecting if a program is running within a session rather than somewhere on the host computer?
Posted 7-Jun-12 6:05am
Edited 7-Jun-12 9:44am
Maciej Los187.3K

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can use a Windows function to determine if you are running on Remote Desktop (a session) or directly on the machine (host computer). Here is a Stack Overflow question with the information you need:[^]
losmac at 7-Jun-12 15:45pm
It might be it! +5
Graham Eady at 8-Jun-12 9:47am
Not quite the problem. I know its running in a remote session the problem is its picking up that another instance is already running elsewhere on the server. I only want to know if the program is running in this particular remote session so that every remote session has only one instance running in each. If there are 4 remote sessions running the program on the server then the server will have the program running 4 times but only once in each of the 4 remote sessions

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Mika Wendelius 290
1 DamithSL 223
2 Afzaal Ahmad Zeeshan 139
3 OriginalGriff 110
4 Suvendu Shekhar Giri 65
0 Mika Wendelius 460
1 OriginalGriff 215
2 DamithSL 213
3 CPallini 169
4 Afzaal Ahmad Zeeshan 129

Advertise | Privacy | Mobile
Web01 | 2.8.150731.1 | Last Updated 7 Jun 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100