We have a vbs All Users script that creates a bunch of printers (approximately 25 printers) when a user logs on. It takes a minute or two to run so we don't want it to run again if not necessary. How can I set some sort of flag so that this script won't run if it's already been run for a user? Deleting the script after it's run won't work because it needs to run for subsequent users who may not have logged on yet.
The simplest solution is likely going to be for the script to look for a particular registry value in HKCU. If it finds the value, exit. If it doesn't find the value, do the work, write the value, then exit.
But eventually you're going to need to modify the script and you will want it to run again. So you should probably make your registry value be some sort of script version number. If the value doesn't exist or is the same as the script's version, exit. Otherwise, do the work, write the value, then exit.