A colleague of mine recently was working on a Windows image with a specific setting for Microsoft Office 2010.  However, the registry key simply would not “sick” and would be stripped out at some point before the user could log on and launch the application.

There are a few options for making changes to all existing and future/new user profiles:
1) CopyProfile in Unattend.xml – only works for new users but will meet the criteria during OS deployment
1) modify the default user profile (load default user hive) – only works for new users but will meet the criteria during OS deployment
2) modify the default user profile AND each existing user profile (load default and each user hive) – works but is a hassle
3) create a Scheduled Task to run at logon – executes code each logon
4) utilize HKLM\Software\Microsoft\Windows\CurrentVersion\Run – executes code each logon
5) utilize Active Setup
There also may be some method I’m not aware of.

Active Setup to the rescue!

A former co-worker who has a background in application development and software packaging introduced me to this feature some time ago.  Here’s a quick and simple example:

With Admin rights (SCCM/MDT/etc.) write the following registry keys:

reg.exe ADD HKLM\Software\Microsoft\Active Setup\Installed Components\<UniqueID> /d StubPath /t REG_SZ /v “cmd.exe /c %ProgramData%\Scripts\myScript.vbs”
reg.exe ADD HKLM\Software\Microsoft\Active Setup\Installed Components\<UniqueID> /d Version /t REG_SZ /v 1,0    (yes commas, not periods)

Each time a user logs on, the script referenced in StubPath will be executed if HKCU\Software\Microsoft\Active Setup\Installed Components\<UniqueID>\Version does not exist or is a lower version.

Active Setup is explained in a more detail over at AppDeploy (now ITNinja) and elsewhere.  See the following articles:
http://www.itninja.com/blog/view/an-active-setup-primer by Bob Kelly
http://www.itninja.com/blog/view/appdeploy-articles-activesetup
https://helgeklein.com/blog/2010/04/active-setup-explained