(imported topic written by BenKus)
Hi everybody,
There has been a lot of activity in our other posts regarding HKEY_CURRENT_USER (HKCU) branches of the registry and how to query/change them so I thought I would start a new post thread with some updated info.
Here are some previous threads for reference:
http://forum.bigfix.com/viewtopic.php?id=11
http://forum.bigfix.com/viewtopic.php?id=1187
Quick recap:
The HKEY_CURRENT_USER branch of the registry is very tricky to query/set for two reasons: 1) there can be no users/multiple users logged on AND 2) the BigFix Agent runs as the SYSTEM account so its HKCU key is not the same as the logged in users.
Here is a brief tutorial on how to query logged on usersâ HKCU branch in BigFix:
Querying the HKCU registry
Here is a simple query of the logged on user(s) IE start pages:
values âStart Pageâ of keys âSoftware\Microsoft\Internet Explorer\Mainâ of current user keys (logged on users) of registry
Notes:
- This will return ââ if the value doesnât exist or if the key doesnât exist or if no users are logged on.
- This should handle multiple users logged on by returning multiple results.
- Works only in BigFix 7.0+ Agents
- If you try this in the Fixlet Debugger, you will get an error âE: The expression could not be evaluated: Windows Error: A required privilege is not held by the client.â, this is normal because only the SYSTEM account can query another userâs registry (if you want to test, try running the Fixlet Debugger as the SYSTEM account: http://forum.bigfix.com/viewtopic.php?id=1098)
Here is a way to return all of the values from all users (logged on or not) from the registry:
values âStart Pageâ of keys âSoftware\Microsoft\Internet Explorer\Mainâ of keys of key âHKEY_USERSâ of registry
Notes:
- There might be a complication with the registry key hives not being loaded if the users havenât logged in, but I am not sure about the exact details of how this works (maybe someone who knows will want to chime in?).
Changing the HKCU registry
Here is how to change the registry for the logged on user:
appendfile REGEDIT4
appendfile
appendfile HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
appendfile âStart Pageâ=âhttp://www.google.com/â
copy __appendfile temp.reg
prefetch RunAsCurrentUser.exe sha1:a72371f4e968da7ead24f0f4e68c14b234ac94f6 size:184320 http://software.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.exe
utility __Download\RunAsCurrentUser.exe
waithidden __Download\RunAsCurrentUser.exe regedit /s temp.reg
Notes:
- Only works if a user is logged on.
- If multiple users are logged on, the user logged in at the computerâs console will have their registry updated.
Hope that helps everyone,
Ben