Registry query not giving desired results when run from the System account
Hi All,
I am trying to deploy two different software that need Revit MEP 2013 and Autocad 2012 before it installs.
To do the check I have used the "reg query" but this is not giving the desired result when it is running from SCCM. but when we run it manually, it runs as expected.
REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7346B4A0-1300-0310-0409-705C0D862004}
REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5783F2D7-A001-0409-0102-0060B0CE6BBA}
Both the above commands give errorcode 1 when run from SCCM but an errorcode 0 when run manually.
Does anyone know about this? I have seen the command prompt run using the "System" account so permission cannot be an issue
I also did a reg query till the uninstall key and that gives an errorcode 0 with SCCM. I do not understand what happens after that.
Thanks in advance
Answers (3)
It turns out that lpksetup.exe on Windows 7 64-bit is a 64-bit-only process so with WOW file redirection in a 32-bit process C:\Windows\System32 redirects to C:\Windows\SysWOW64, which does not contain lpksetup.exe. So I altered the ConfigMgr program command line to: %WinDir%\SysNative\lpksetup.exe /i de-DE /p . /r /s Using the SysNative alias allowed the language pack to be successfully installed on Windows 7 64-bit from a ConfigMgr advertised program.
Why not either chain the installations of the pre-reqs to your deployment, or use a dynamic collection in SCCM to populate your deployment group for your application based on whether they already have the two software titles that are the pre-reqs (ARP query)?
It seems a convoluted way of doing it with a reg query, when your deployment tool can handle this in a much better way.
Dunnpy
Comments:
-
We have customized way of deploying the software because of the nature of the environment and the size of the software. We wanted to use reg query to make sure we have the pre reqs installed before the addins install.
I 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? - vijumenezes 12 years ago
By using WMI one can read the HKLM 64/32 bits registry as shown in the following example:
' To read from the corresponding 32-bits Uninstall registry entry it suffices to simply change 64 tot 32.
Const HKEY_LOCAL_MACHINE = &H80000002
Application = ReadRegStr (HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}", "DisplayName", 64)
' Reads a REG_SZ value from the local computer's registry using WMI.
' Parameters:
' RootKey - The registry hive (see http://msdn.microsoft.com/en-us/library/aa390788(VS.85).aspx for a list of possible values).
' Key - The key that contains the desired value.
' Value - The value that you want to get.
' RegType - The registry bitness: 32 or 64.
'
Function ReadRegStr (RootKey, Key, Value, RegType)
Dim oCtx, oLocator, oReg, oInParams, oOutParams
Set oCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
oCtx.Add "__ProviderArchitecture", RegType
Set oLocator = CreateObject("Wbemscripting.SWbemLocator")
Set oReg = oLocator.ConnectServer("", "root\default", "", "", , , , oCtx).Get("StdRegProv")
Set oInParams = oReg.Methods_("GetStringValue").InParameters
oInParams.hDefKey = RootKey
oInParams.sSubKeyName = Key
oInParams.sValueName = Value
Set oOutParams = oReg.ExecMethod_("GetStringValue", oInParams, , oCtx)
ReadRegStr = oOutParams.sValue
End Function
Set wshshell = CreateObject("WScript.Shell")
on error resume next
wscript.echo Application