Hi guys,

I am using the code below to prevent more than one instance of an application from running on a workstation and it has worked flawlessly for years.

However, the company is moving everything to the cloud. The cloud has been set up as having a virtual server and ONE virtual workstation, but with multiple users being able to log into this single workstation. Naturally enough, the code below now displays if more than one user runs the application even though they are signed in as a different user.

Is there a way to detect "sessions" and processes within that session so that my application will still prevent multiple instances from running within the same user profile?

Code:
// First, check that the PBS System is not already running.
Procedure CheckDuplicateProcess
    Integer iProcesses
    Get CountProcess "Pbs.exe" to iProcesses
    If (iProcesses <> 1) Begin
        Send Stop_Box "The PBS System is already running."
        Send Exit_Application
    End
End_Procedure

Send CheckDuplicateProcess