I have created a script that I need to push out to client machines, and I only need the script to run one time. If it runs a second time our users will be pretty unhappy.

1. I am in the process of testing this feature, but I was wondering if anyone has experience using the scripting option "Also Run Once at Next Client Check-in" (aka, when it downloads new scripts). Does this mean the KBOX agent will run that script once and only once, or will it run it once every time it checks in for scripts?

2. Is there an eloquent way to create the KBOX script so that before it even thinks about running it checks for a registry value, and if that value is present the script will end? I know you can check for values, but I don't think it's possible to tell the KBOX to exit a script totally unless there's an error.
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


"Run once at next check-in" is just like it sounds. If there is a scripting log for that machine, the script will not run again unless there is a schedule or the script is run manually.

The verify should do exactly what you want. The verify can check a registry value. If true, the script executes the “Success” and exits. If false, the script executes the “Remediation”. The logic flow is on the right side of the scripting page.

What you probably want is to check that a registry value DOES NOT exist. That way, if the value does exist, the script exits. Put all of you action in the "Success" and leave the other sections blank.

This is the format for 90% of all my scripts and it works perfectly.
Answered 10/13/2010 by: bgatech
Orange Senior Belt

Please log in to comment
Actually, I am finding in our environment that when "Run once at next check-in" is selected, it runs at least twice, and there is an existing scripting log for the machine. I had to build in error checking so that it checks for a pre-defined registry value.. if it doesn't find the value, it runs the script.. if it finds the value, it sets another registry key (so I know it already had run on that machine), and then aborts.

This seems like a bug... is that behavior correct? The script is not running on a schedule.
Answered 10/13/2010 by: wkucardinal
Orange Senior Belt

Please log in to comment
I implemented a RunOnce mechanism for several of my scripts here. Some variation of this will do what you want:
1. For scripts that Run as System, use a registry key like HKEY_LOCAL_MACHINE\SOFTWARE\KACE\RunOnce. For scripts that Run As ... User, use a registry key like HKEY_CURRENT_USER\Software\KACE\RunOnce.
2. For your script, use the XML editor (or peek at the database) to see the script's unique identifying number. For this example, I'll use 123.
3. In the first verify step of each task in your script, Verify that the registry value HKxx\Software\KACE\RunOnce!123 exists, where xx is the key you chose in step 1. (Its value does not matter.) If the key does not exist, perform your script steps in the Remediation section. (Nothing in the Success section)
4. At the end of your last task in your script, in a section where it's sure to run, Set the registry value HKxx\Software\KACE\RunOnce!123 to something. (It doesn't matter what, nor whether it's a string or DWORD.)

This has worked perfectly for me. Each Run As System script runs exactly once; each Run As ... User script runs exactly once for each user on a computer.

The only complication has been with ITS support staff who sometimes, for troubleshooting, need to run one of the RunOnce scripts more than once. I've had to talk them through clearing the appropriate registry value. Sande
Answered 10/15/2010 by: snissen
Fourth Degree Green Belt

Please log in to comment
My question with this option "Also Run Once at Next Client Check-in" is does "also" mean "run now or at this time" and "Also Run Once at Next Client Check-in"?

Above the "Also Run Once at Next Client Check-in" option are these options:

Don't Run on a Schedule Run Every Run Every at : Run on the of at : Custom Schedule:

So I'm wondering, does the option imply that one of these is set? What I'm looking to do is to use the offline kscript to run the script ONLY at the next client check-in, not a specific time. I tested this by just selecting "Also Run Once at Next Client Check-in" and not selecting a run time and it didn't work. Is it supposed to? How do I run a script only at client check-in?
Answered 12/27/2011 by: lefttunknown
Orange Belt

Please log in to comment