0

I am trying run a batch file for a installation and I have used reg query to determine the presence of the pre-requisites and continue the installation.

When I run the batch file manually it works as expected but then when I use SCCM to execute this batch file it fails.

I put a pause and echoed the Errorlevel and found that reg query is not able to find the registry that is actually present when it runs using the "System" account

Is any one aware of this? Any suggestions on how to query the HKLM registry using the system account

Thanks in advance.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall – Vijay Menezes Oct 26 '12 at 12:51
  • I went down the layers to see where I am getting stuck... All the way till HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall the reg query works fine but then I am referring to REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7346B4A0-1300-0310-0409-705C0D862004} then it ends up with a error code 1 even though I can see it there and it comes up when you run it manually. – Vijay Menezes Oct 26 '12 at 13:26
  • Used Process Monitor to see what is happening and found that the reg query defaults to HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall and so it is not able to find the keys under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall Is anyone aware to point the reg query to the keys that I need it look into? – Vijay Menezes Oct 29 '12 at 16:09
  • 1
    I have 2 versions of reg.exe on my box, one in system32 and one in SysWow64. I guess the sccm one is using the reg.exe in syswow64 and from the command prompt it hits the one in system32. That explains the difference is query behaviour. Maybe you can try to force it to use %windir%\system32\reg but I'm not sure if that is allowed. (starting a 32 bits process as a child of a 64 bits process) – rene Oct 29 '12 at 20:35