Hi All,
I am using the Wscript shell to check the registry entry in the VBscript. When i am running the code from console it is working but when i run the same through a custom action from an installer. It is giving below error message:
Error Message:
###Info: -2147024894 ::: Invalid root in registry key
"HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.6\InstallPath\". ::
WshShell.RegRead
Script used:
Function readFromRegistry(strRegistryKey, strDefault)
Dim WSHShell, value, CheckFor, CmdToRun, returnValue
On Error Resume Next
err.Clear
Set WSHShell =
CreateObject("WScript.Shell")
value = WSHShell.RegRead(strRegistryKey)
if err.number <>
0 then
readFromRegistry = strDefault
else
readFromRegistry = value
end if
MsgBox readFromRegistry
set WSHShell = Nothing
End Function
'call readFromRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.6\InstallPath\", "NONE")
call InstallWebdrivers()
'call readFromRegistry("HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.6\InstallPath\", "NONE")
Function InstallWebdrivers()
Dim strCMD, strRootFolder, strPythonInstallPath, strWebMgrPath, strResult
strPythonInstallPath =
readFromRegistry("HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.6\InstallPath\",
"NONE")
IF strPythonInstallPath =
"NONE" Then
strPythonInstallPath =
readFromRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.6\InstallPath\",
"NONE")
End IF
IF strPythonInstallPath =
"NONE" Then
strPythonInstallPath =
readFromRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\3.6\InstallPath\",
"NONE")
End IF
'MsgBox strPythonInstallPath
strWebMgrPath = strPythonInstallPath &
"\Scripts\webdrivermanager.exe"
strRootFolder =
"C:\"
strCMD = """" & strWebMgrPath &
"""" &
" --linkpath " & strRootFolder &
" chrome firefox"
Wscript.Echo(strCMD)
'strResult = RunPowerShellCommand(strCMD)
End Function