Batch File not working (Sub key folder is not created in registry)

I want to run a batch file on several computers.
This is the Action Script:

dos copy "\Folder1\Download\regpatch.bat “C:\Temp\regpatch.bat"
wait cmd /q /c “C:\Temp\regpatch.bat”

And the regpatch.bat file contains:

REG ADD “HKEY_LOCAL_MACHINE\SOFTWARE\Open Text\TestPrograms” /v AllowAutoAuthentication /t REG_DWORD /d 1 /f
REG ADD “HKLM\SOFTWARE\WOW6432Node\Open Text\TestPrograms” /v AllowAutoAuthentication /t REG_DWORD /d 1 /f

After running the regpatch,bat file, the first line is not created in the Registry.
The new sub key folder (TestPrograms) is not created in “HKEY_LOCAL_MACHINE\SOFTWARE\Open Text" but for “HKLM\SOFTWARE\WOW6432Node\Open Text”, the new key sub folder (TestPrograms) is created.

Please advice.

Probably due to wow redirection. As Bigfix is natively a 32 bit agent the DOS command will spawn a 32 bit process meaning the reg add will be subject to wow redirect so KHLM\Software becomes HKLM\Software\Wow6432Node.

Try adding action uses wow64 redirection false before the DOS command and see if that make any change.

See https://developer.bigfix.com/action-script/reference/execution/action-uses-wow64-redirection.html

An alternate option would be use the native regset and regset64 ActionScript commands where regset on a 64 bit OS will write to HKLM\Software\Wow6432Node, regset64 to HKLM\Software

if {x64 of operating system}
	regset "[HKLM\SOFTWARE\MyKey]" "MyValue"="something"
else 
	regset64 "[HKLM\SOFTWARE\MyKey]" "MyValue"="something"
endif
2 Likes

Hi, thank for the reply.

Currently I am facing issue with importing the registry key values (in HKEY_CURRENT_USER\software\Policy\Microsoft Office\16.0 etc) the registry key values doesnt seems to be importing it.

The Bigfix agent runs as SYSTEM, so HKEY_CURRENT_USER in that context is not the logged on user.

Also, HKCU is loaded & unloaded by user logon/logoff.

You probably need to read this thread to understand how to achieve the desired results

1 Like