Making a Toggle Switch

David is a Desktop Advisor at Macquarie Bank Limited in Sydney, Australia. Mark Poole of our Board of Review had the following comment about this cool solution: "This is a great suggestion on how to make ZEN into a toggle switch for
any project, not just the one mentioned here. It is these kinds of "now
why didn't I think of that?" ideas that makes Cool Solutions such a
useful site." Thanks, David!

In a recent Q&A you answered the following question, and suggested tweaking to improve it. My suggestion is below.

Original Question

Simon G., UK, wrote: I have about 1000 users who all want to use a few apps. I applied the apps at the top-level container (as they are in several different containers) and put a force run on the apps (they want GroupWise and IE5 to run on startup).

Now about 50 users have said they don't want the app to startup automatically but they still want to be able to run the application. How can I get this to work without major admin? I tried applying the app without the force run to individual users but it still picks up the force run from the container.

Thanks to ZEN 2 (you are running ZEN 2 aren't you?) this isn't really that hard, and ends up being almost no work for you at all (and isn't that after all the whole point of ZEN?).

Here is what you do. Duplicate each of those apps, and sync their GUIDs. (A great tool for this can be found in the ZENworks 2 Toolkit). Mark one force run, and the other not, and associate both with your "top-level container". Then, in the requirements of each application reference a dummy file, say for instance: c:/noforce.txt. On the force run app, require that this file not be present. On the other one require that it be there. Now all your users have to do is to create or delete this file to switch back and forth. This lets all 1000 folks decide for themselves whether they want the force run version or not. They can change their minds as often as they want, and best of all, they never have to call you.

Note that you could also do this using an environmental variable, registry setting, or anything else ZEN can detect, so feel free to tweak it to your use.

Here's my suggestion:

So your users don't have to know how to create the flag file, and (if you use roaming profiles) so the setting follows them to another machine, create icons that set HKeyCurrentUser registry settings that the above method uses to determine which app object they run.

For example, have the auto run icon look for an registry key called something like HKCU\Software\Whatever\RunAtStartup=1

and the manual run icon look for HKCU\Software\Whatever\RunAtStartup=0

Now create two more icons which set these registry keys, and only appear when ZEN detects the opposite Registry key exists. For example, create one icon called "Run Outlook at Startup" that only appears if ZEN 2.0 detects HKCU\Software\Whatever\RunAtStartup=0

and that sets HKCU\Software\Whatever\RunAtStartup=1

Create a second icon called "Don't Run Outlook at Startup" that only appears if ZEN 2.0 detects HKCU\Software\Whatever\RunAtStartup=1 and that sets HKCU\Software\Whatever\RunAtStartup=0