|
How to run
a ZENworks Application Once and only Once: Other Options
After my first
article, regarding running an application "Once and only Once per
day", I received numerous questions about other ways to do this.
Two of the common questions were -
1. Once and Only
Once per day on Specific Days of Week.
This option allows administrators
to run certain actions once a week on a machine, such as a Virus
Scan every Monday or every Tuesday, etc....
Simply create the
application as specified in the previous "Once and Only Once Per
Day". Then add a single additional system requirement based upon
the environment variable %NDAY_OF_WEEK. %NDAY_OF_WEEK returns a
numeric string value equal to the day of the week with Sunday
returning a value of "1" and Saturday returning a value of "7".
Therefore if you only want the application to run on Monday, then
set a system requirement for the environment variable %NDAY_OF_WEEK
to be equal to "2". The tricky part is that the NDS variable %NDAY_OF_WEEK
can't be directly tested in the environment variable section of the
application object, even though it can be used in other parts of the
application such as setting registry values or writing to a text
file. To get around this, set a variable such as TODAYIS in the
login script by issuing a "DOS SET TODAYIS="%NDAY_OF_WEEK". Then in
your application object, test the variable "TODAYIS".
2. Once and only
Once per machine -
Often force run
applications may try to run each time a new user logs onto a PC.
Depending on the application, this can become quite a nuisance.
Through a little tweak of the application object, this can be easily
prevented.
Each time an
application is run, it will make a registry marker under HKLM .
This key is HKLM\Software\Netware\NAL\1.0\Distribute\[TREENAME]\[GUID].
The GUID is a unique number that will identify each application.
This number can be seen under the properties of the application in
NWADMIN32 or ConsoleOne. You can also identify the registry marker
on machines that have run the application since the marker key will
contain a value name called "DN" which is equivalent of the fully
qualified name of the application object.
Simply Create a
SYSTEM REQUIREMENT for the application that is equal to the HKLM
registry key that is unique to the application object. Set the
requirement for the NON-EXISTENCE of the key. This way the
application will never try to run again on that machine.
 |