Limiting Users to One Instance of an App
Novell Cool Solutions: Trench
Digg This -
Posted: 1 Nov 2000
Earlier we ran this Q&A and, as usual, you guys had some cool ideas we hadn't thought of. Here's what we said:
Question: Paul M., Dublin, Ireland, wrote: Again, thanks for this beautiful product (2.0). Our corporation in Ireland has been using it successfully in an NT Roll-Out situation and Users/Admins are astounded. Now, the Q is, is there any way, apart from s/w metering, to limit users to run particular applications ONLY once from NAL, i.e. a user can use only one instance of an application at a time?
Answer: Sorry, not really. You could set a policy in place to only allow the user to run NAL or NALEXPLD.EXE, then only NAL can run EXEs. That may work. Anyone else out there have a cooler way to do this?
- Tommy Mikkelsen
- David Linker
- Egbert Veldman Posted Nov. 15, 2000
- Ron Reece and Scott Shaheen Posted Nov. 15, 2000
You had a question regarding "Limiting users to one instance of an app." I've found an ugly solution, but it works :-)
This is for NT workstations, but fiddle a bit with it, and it's for Win9x as well.
- Make a "Run before Launching"-Script that looks like this:
#cmd /c echo running > c:\%CN
- Make a "Run after Termination"-Script that looks like this:
#cmd /c del c:\%CN
- Make a System Requirement that the file c:\%CN% doesn't exist.
This should do the trick, IF you have enabled automatic refresh of the NAL, cause it seems like the NAL only reads the app's requirements when initialized.If you've got roaming users, use a file on your server, and give your users/wkstn rights to the directory where you put the file.
If you have any questions regarding this, feel free to send an E-Mail to email@example.com
Here is a possible solution (with a minor caveat) to the problem "Limiting users to one instance of an app."
The way to do this is have the app do a distribute always of a flag file to the workstation eg c:\APP.FLG
In the "Run after termination" script, add a line to delete this check file.
In the system requirements for this app, only make the app available if APP.FLG does not exist (I would have the app not appear in the NAL at all or the users will work out that deleting the flag file will give them multiple instances).
The problem is that if the machine crashes before the check file is deleted, they can't run the app even after a reboot. This can be handled by deleting the check file with a command run from the login script or windows startup or possibly a force run (although the latter means that a NAL refresh will allow them to run the app multiple times).
On the Internet is a freeware utility - PWone. This program prevents more than one copy of a program from running at a time. This is from the readme file:
Run PWONE.EXE in place of the program to be limited. PWOne's command line must contain two parameters:
- All or part of the title bar text normally displayed by the program to be limited (this must be enclosed by parentheses)
- The command originally used to launch the command to be limited. For example, to
prevent more than one copy of Excel from running at a time, you might create an
icon for PWOne.exe with this command line text:
PWONE.EXE "Excel" C:\Office95\Excel\Excel.exe
Once run, PWOne determines if a copy of the limited program is already running (by searching Windows' Master List for the limited application's title bar text). If a running copy is found, that copy is activated. If no running copy is found, a new copy is launched using the provided command line.
You create your NAL icon with this command line and the utility will do the rest. The PWone program must be located in a Search drive as well as the required VB dll files.
It can be downloaded under: http://www.winmag.com/software/toolkit.htm
We use this program with all our installations and have not have had any problems with this utility.
If you have any questions you may contact Egbert at firstname.lastname@example.org
Use DOS Environment variables to control the number of instances of an application. The following is an example of a Pre/post application launch script:
DOS Set count="0"
#z:\public\sayit "You already have a <application name> session running. Please, exit the current <application name> session normally before attempting to start a new session."
set count = "0"
(Sayit.exe is a GUI message utility downloaded from the CoolSolutions Cool Tools page.)
If your users are like ours, they need more than one session, but still need to be limited to the PC's/application's capacity. One of my co-workers came up with the following modification to the script:
if <count> == "3" then begin
#sayit You already have 3 copies of <application-name> running.
if <count> == "2" then begin
dos set count = "3"
if <count> == "1" then begin
dos set count = "2"
dos set count = "1"
if <count> == "3"
dos set count = "2"
if <count> == "2"
dos set count = "1"
if <count> == "1"
dos set count = "0"
Please note: The count is set in reverse order to compensate for the GOTO statement that would normally be used in a BATCH file, as GOTO functions as "exit" in a script.
DOS rules still apply, and can be used for some interesting combinations.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com