Need to update a value under current user loggin registry Hive

Need some help on below action script which will be updating value under all the SID under HKEY_USERS Key.

delete __appendfile
appendfile {concatenation "%0d%0a" of ("reg add %22HKEY_CURRENT_USER\\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location%22 /v %22Value%22 /t reg_sz /d Allow /f") of names of keys of key "HKEY_CURRENT_USER" of registry}
delete delreg.bat
move __appendfile delreg.bat
waithidden delreg.bat

This need to be modified to only update the value under the logged on SID key.

1 Like

The correct way to do this is to use Local GPO to modify the value for all existing and future users, not to try to directly edit the current user hive, which does not actually exist in the context of the agent.

There is ways to manipulate the hive for the currently logged in user only, but still, it is best to use LocalGPO to achieve this.

See this example: https://bigfix.me/fixlet/details/3741

I can do local GPO but I already made a solution without local GPO and in testing on that will share soon for further expert suggestions.

Any solution that doesn’t use Local GPO will only work if a user is currently logged in and only for that hive, unless you loop through and make the change for all users.

Even if you loop through and make the change for all users, that will then not take affect if a new user logs into the system that did not have their hive loaded when the change was made.

Thus the only way to ensure per-user registry changes is to use LocalGPO.

The only reason you might NOT want to use LocalGPO is if you want to allow users to change this setting themselves to whatever they want, but you only want to set a default value but allow them to change it later. If you want to force this to be enabled and not allow users to disable it, then LocalGPO is your best option.

It looks like you are trying to enable location services: Windows 10: How to Turn on or Turn off Location Services - WinBuzzer

It does seem like a good idea to manage all the basic windows 10+ settings for things like this.

1 Like