Amending current-user (HKCU) registry keys from an SCCM package is a genuinely awkward problem: packages normally run in the SYSTEM context, but HKCU only exists for a logged-in user’s session, so a SYSTEM-context install can’t directly write to a specific user’s hive the way it can with HKLM.
The General Approach
The common workaround is to have your package trigger a small piece of logic that runs in the user’s context rather than trying to write HKCU directly from a SYSTEM-context installer:
- Package a
.regfile containing the keys/values you want to set. - Deploy a small script (batch or PowerShell) alongside it that imports the .reg file using
reg import, but trigger that script to run in the user’s context — either via a scheduled task created to run “only when user is logged on,” a logon script, or (on modern ConfigMgr) an Application deployment set to install for the User rather than the Device, with “Install for user” behaviour.
Trying to force a HKCU write from a SYSTEM-context package by targeting HKEY_USERS<SID> directly is possible but fragile — it only works reliably if the target user is logged on and their hive is loaded at the exact time your package runs, so the “run as user” approaches above are generally more robust for production deployment.
Resources
Gear We Recommend
Testing configs is easier with a dedicated admin machine set up right. Here’s the kit we use.
Browse our Windows Admin Toolkit picks on AmazonAs an Amazon Associate, TechyGeeksHome earns from qualifying purchases.
Discover more from TechyGeeksHome
Subscribe to get the latest posts sent to your email.