Re: Newbie to logon scripts - how to make a script run once only?



Stephen wrote:

I have a very simple logon script which runs an .msi file to install
the SOAP toolkit. The script has but one line -

<path>soapsdk.msi /quiet

I want this to run once and once only when the user logs on.

How do I do that? Or is it even possible?

You need to be able to test for something that indicates whether or not the
..msi has run. If the .msi deploys a file or creates a folder, your logon
script can check for the existence. If the .msi creates a registry entry,
you can check for that. If the .msi updates a file, you may be able to check
the file version or date.

Another option is to have the logon script itself do something that you can
later test. For years I had logon scripts save what I called "flag" files.
The logon script would check for the existence of the flag file. If it
existed, exit. Otherwise deploy and save the flag file. The location and
nature of the flag file depends on the deployment. If you want something
deployed once for each computer, the flag file is saved somewhere on the
computer accessible to all. If the deployment is once per user on each
computer, then you must save the flag file in a different location for each
user, or name the flag file in some way specific to the user.

Instead of flag files, you can do the same thing with registry entries. For
a deployment to the computer, save a registry setting in HKLM. For a
deployment to the user, save in HKCU.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net


.



Relevant Pages

  • Re: cron jobs not done during sleep
    ... First thing in your script look for a flag file indicating last time ... If the flag file does exist compare dates. ... they must first drive mad. ...
    (freebsd-questions)
  • Re: [SLE] Pullin my hair out... arrrgh
    ... > story of the donkey that needed a 2x4 in the head to get its attention so it ... Alternatively, what the original poster said, is to have the script run ... Ie, the first time it would run at 00:00 hours, and would save a flag file ... the flag file, notice the time lapse not being 18 hours, ant exit. ...
    (SuSE)
  • Re: Application to be called - runas Administrator
    ... you can run the script through MS script encoder, ... >I don't believe you can compile a vbscript - this information was passed on ... This flag file would be checked for presence in the ... >> beginning of the compiled program to bypass if it had already been run on ...
    (microsoft.public.scripting.vbscript)
  • Re: [Full-Disclosure] Cleanining viruses from netware
    ... Another approach is to use a login script that runs the disinfection ... run, run the script and then *IF* successful, create the flag file. ... infected machines and remove them. ...
    (Full-Disclosure)
  • Re: [SLE] cron.daily
    ... > The main script gets run every 15 minutes. ... NO math is performed, cron runs when instructed. ... > This ensures that each flag file is deleted, if the machine is running at ... boot your machine at 8:10 run-crons will still run at 8:15 -not- at ...
    (SuSE)