/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


Need Active Setup to run on every logon

08/24/2018 2223 views

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

Comments



Community Chosen Answer

2
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.
Answered 08/31/2018 by: kalucas
Senior Yellow Belt

All Answers

0
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 ;-)
Answered 09/12/2018 by: macxcool
White Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
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