Need Active Setup to run on every logon

I have an Active Setup which adds files/folder structure to the user’s (%appdata%) Roaming profile post install of software and reboot of machine. In researching Active Setup, I learned that it runs a single time for each user. My need is for this to be run each time a user logs into Windows. There are a couple of reasons for this need. An example is if someone were to mistakenly delete a file from their Roaming profile that was generated from the Active Setup. In this scenario, rebooting/logging back into Windows will not kick off the Active Setup because it had already run once previously on the original install. Another and more pressing reason is that the folder structure and files that get created on first logon post install&reboot are not getting created a second time after uninstalling from the first install – as follows:

Virgin machine Install – reboot – login – folder structure/files created – uninstall – reinstall – reboot – login = Folder structure/Files not created

I think that the Active Setup from the first install left a thumbprint in the registry indicating the that it has already been run.   

 Is there a way for any file to be checked for its existence and be added if missing? I suspect a reg key and Custom Action have to be added to accommodate..? Since hard coded paths do not work for Roaming profiles, any script and reg key would have to use environment variable (%appdata%) so that it would apply to whomever is logged in at the time.

My question is, is there a way to get an Active Setup to run every time a user logs in?

If instead a Custom Action with script has to be used, please include the script itself (and what settings should be set in the Common tab of the Custom Action).

Been banging my head on this for too long..! Please, any help is greatly appreciated!

Thank you.

0 Comments   [ + ] Show comments

Answers (2)

Posted by: kalucas 2 years ago
Senior Yellow Belt
You are correct, Active Setup will run once and then it updates a reg key in HKCU to indicate that it has already run for that user.  If you delete that key from HKCU then Active Setup will run the next time the user logs in.  

The keys to look at for the machine can be found here:
HKLM\Software\Microsoft\Active Setup\Installed Components
HKLM\Software\Wow6432Node\Microsoft\Active Setup\Installed Components

Your Active Setup master key will be in one of the folders under Installed Components.  When you find the correct one, there will be a version setting in it.  This is what Active Setup uses to compare to the corresponding key in the User hive.

User keys are in one of these places:
HKCU\Software\Microsoft\Active Setup\Installed Components\
HKCU\Software\Wow6432Node\Microsoft\Active Setup\Installed Components

Deleting the version setting in the HKCU key, changing it to a value less than the version in the HKLM key, or deleting the entire folder under Installed Components in the HKCU hive will trigger Active Setup to run on next login for that user.

Having said all that, Group Policy is perfect for this kind of situation.  Is there any reason you're not using Group Policy for this rather than Active Setup?  All you would need to do would be to set up your file copies with an Update or Replace option and you're done.
Posted by: macxcool 2 years ago
White Belt
If I'm not mistaken, if the version number is left out of the HKLM Active Setup key, the item should run on every logon, shouldn't it?
I'd suggest the HKCU 'Run' registry key or a scheduled task that is triggered by a user logon event. With the scheduled task you can even access information about the logon as variables that can be passed to a script. It's more versatile than Active Setup (and actually documented ;-)
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ