Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

server based application......

Status
Not open for further replies.

veronicadiaza

Programmer
Oct 9, 2009
7
US
Hiii all....I have a server based application in which all employees access through a shortcut on their local computer and the application should not be opened more than once by the same employee at the same time.

Please help me with the script regarding this.
Hope to hear from you soon.....


 
change teh shortcut to call a vbscript instead of the server based exe. in the vbscript do a WMI call to Win32_process and check if your exe is already running, check out a post this week on closing down notepad, it will give you the code base for enumerating running processes
 
this was taken from the other post
i have added a little, please note it is not complete especially regards WshShell

blnAlreadyRunning = False
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcessByName = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'yourexehere.exe'")
'can we use teh colProcessByName.Count?
For Each objProcess in colProcessByName
'if you get an instance here then one is running..
blnAlreadyRunning = True
Next
Set colProcessByName = Nothing
Set objWMIService = Nothing
If blnAlreadyRunning = True Then
Msgbox "session / app already running"
Else
'do your call to the server app here
intReturn = 666
On Error Resume Next
intReturn = WshShell.Run(Chr(34) & "\\servername\share\a folder\app.exe" & Chr(34) & , 1, False?)
On Error Goto 0
If intReturn = 0 Then
'all good
Else
Msgbox "sorry failed to launch app"
End If
End If
 
Hiii mrmovie,

Do you mind telling me what do you mean by \share\a folder\ in the following line of the script?
Do you mean giving the path of my application...?

intReturn = WshShell.Run(Chr(34) & "\\servername\share\a folder\app.exe" & Chr(34) & , 1, False?)
 
yeah, i am guessing that you are really just calling an exe from a network share? its actually doesnt matter where the exe is located, it could be local on your c drive the process would be the same
 
you will need to drop the & ..unless you want to launch with some params and i phave put False? which is saying your launching script wont wait the exe which is run to quit...actually it sort of renders the error checking useless only to serve if the user hasnt got access to the binary which ,run is calling or it cannot be located...
 
Thank you mrmovie for your reply. All the applications are running through citrix. so If an employee clicks on an application link, the session of this application is created in the server in the name of that specific employee.That specific application should not be launched again by the same employee at the same time.help me with the script regarding this.....
 
what type of link is the 'application link' you mention?
 
The application link is like a shortcut for an application.If an employee clicks on that the session of this application is created in the server in the name of that specific employee.That specific application should not be launched again by the same employee at the same time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top