Monday, March 30, 2015

Gotcha - setting registry values via ConfigMgr

We have a package with a program that is supposed to set a registry value. This is a simple command, right?

reg add HKLM\Software\Whatever /v "KeyName" /t REG_SZ /d "Value" /f

When we deployed the program, the value would not be where we expected it, instead we found it here:

HKLM\SOFTWARE\Wow6432Node\Whatever

This blog post explains why this happens (32-bit process running on a 64-bit OS).

The fix is easy, simply add "%windir%\SysNative\" in front of your REG ADD command, like this:

%windir%\SysNative\reg add HKLM\Software\Whatever /v "KeyName" /t REG_SZ /d "Value" /f

Works like a charm!

H/T Brpo's Blog