Changing reg key values under Hkey_Current_User?

Working with a fixlet that is running as current user, In theory, if I run “reg add” or “regedit x.reg” file from with in the run.bat file, it should work and add to the HKCU part of the reg. I have found this not to be true, and these command do nothing when run in the run.bat
Instead I have found a work-around, by spawning a .exe file from with in the run.bat, with this .exe I can set the keys I need in the HKCU. If I write a VB.net program to set the reg keys I need and run the .exe from with in the run.bat part of the action code. I have used this method many many times and it works great.
This normally works fine, but I have run into a value that I am trying to set, but the program named ASAP that needs to read the key values, does not like the key values I am setting even though they are identical to the values that are set from a .reg file that is run manually that does work. so I have to resort to using this .reg file for some reason to set the key values I need.
anyway does anyone know of a way I can get a “regedit /S x.reg” to work with in the run.bat file that is running as current user???
This does not make any sense, because spawning reg or regedit should be the same as spawning a separate .exe file.
anyway I suspect it has something to do with the way the Bigfix pseudo run as current user environment is created.

oh I have also tried powershell for setting the keys and I get the same result of nothing, no key values are created.
and I have also tried replacing the default bigfix command wait "{parameter “outsideOfClientFolder”}\run.bat"
with wait dos regedit /S x.reg
but that also did not work.
and yes I have checked to make sure a 32bit redirect is not happening.

Just a note: The reg value is a encrypted license key and I suspect the length or a asci control character in the value is why my .exe is not liked by the ASAP program I am trying to license, so trying to set the keys directly from bigfix via regset command will not work either. so I am stuck using the .reg file for setting the values.

Any help is appreciated.
Thank you

Reviewing the user override options tip at Tip - Action Override User settings may be helpful.

Consider that by default the process launches in 32-bit mode, so you may need ‘action uses wow64 redirection false’ in the actionscript, else the registry values may end up at HKCU\Software\Wow6432Node

Consider that the spawned process, running as a standard user, probably does not have access to the ‘BES Client\__BESData’ folder, and your .reg file, script, or executables may need to be stored elsewhere.

Likewise, you may need the spawned shell to explicitly ‘cd’ to a folder the user can read, to use as its “current working directory” - i.e.

wait cmd.exe /c “cd C:\windows\system32 & reg.exe add “HKCU\Software\MyTestKey” /v “MyTestValue” /t REG_SZ /d “This is my test” /f”

2 Likes

Thanks Jason, I will try giving the full paths to the command and see if that helps.

regset "[{user key of logged on user}]"

values whose(name of it as lowercase as string = "sidstring") of keys of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileGuid" of (x32 registries; x64 registries)
1 Like

thank you for all your suggestions, but they did not help I could not run the .reg file.
in the end I found a key value I fat fingered in my VB code, once corrected I was able to get this to work.

1 Like