We help IT Professionals succeed at work.
Get Started

How to check if an Access Application (not Process) is open for a user on a 2008R2 remote desktop server in vbs

Last Modified: 2016-02-11
I have some code that i use to test if a "process" is running for a user on a 2008R2 Remote Desktop server:
Dim IsOpen As String
Dim Loopcnt As Integer
Dim MaxLoops As Integer
Dim shell
Dim oNetwork                'Network Access Object
Dim sUserName               'Login Name of User
Set oNetwork = CreateObject("Wscript.Network")
sUserName = oNetwork.UserName
IsOpen = "N"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'VMMFGWIN.EXE'")
For Each objProcess In colProcessList
      If objProcess.GetOwner(tUser, Domain) = 0 Then
         If tUser = sUserName Then
            IsOpen = "Y"
         End If
      End If
If IsOpen = "Y" Then
   Set shell = CreateObject("WSCRIPT.SHELL")
   shell.Run """\\Ct01\root\Visual\Scripts\OpenWO.vbs"" """ & Me.Base_ID & """ " & Me.Lot_ID & " " & IsOpen, , False
   MsgBox "Manufacturing Window must be open before you can open the Work Order"
End If
Set shell = Nothing

Open in new window

I need to test to see if a user has a Microsoft Access application open.  The above code can only tell me if the user has MSACCESS *32 open.  I need to know if they have a particular Microsoft application called "QUA20  Data Books" open.
Remember the user is on a Remote Desktop Server.  20-30 users may have the QUA20  Data Books application open on the "Terminal" Server.  I need to know if the current user has it open.

Any help would be greatly appreciated.
Watch Question
Owner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE