Open chelming opened 9 years ago
You can't just change baseRegistry to ESR because while CurrentVersion is under HKLM\Software\Wow6432Node\Mozilla\Mozilla Firefox ESR\
, the Install Directory is under "HKLM\Software\Wow6432Node\Mozilla\Mozilla Firefox\" & firefoxVersion & "\Main\Install Directory"
small change:
Sub locateInstallation()
On Error Resume Next
firefoxVersion = objShell.RegRead(baseRegistry & "CurrentVersion")
If Err.Number <> 0 Then
writeLog "Mozilla Firefox not installed. Exiting."
Err.Clear
WScript.Quit(1)
End If
On Error GoTo 0
'firefoxInstallDir = objShell.RegRead(baseRegistry & firefoxVersion & "\Main\Install Directory")
'firefoxVersion = split(firefoxVersion,Chr(32))(0)
'firefoxMajorVersion = split(firefoxVersion,Chr(46))(0)
'If the Firefox installation directory can not be found in the registry, use the default 32-bit OS location
'(C:\Program Files\Mozilla Firefox) by default.
If firefoxInstallDir = "" Then
Dim colArchitecture : Set colArchitecture = objWMIService.ExecQuery("Select AddressWidth from Win32_Processor")
Dim objArch, strArch
For Each objArch In colArchitecture
strArch = objArch.AddressWidth
Next
Select Case strArch
Case "64"
firefoxInstallDir = objEnv("ProgramFiles(x86)") & "\Mozilla Firefox"
Case "32"
firefoxInstallDir = objEnv("ProgramFiles") & "\Mozilla Firefox"
End Select
End If
writeLog "Installation Directory: " & firefoxInstallDir
End Sub
The script checks
HKLM\Software\Wow6432Node\Mozilla\Mozilla Firefox\CurrentVersion
and reports not installed when using Firefox ESR.The correct path for Firefox ESR's CurrentVersion is
HKLM\Software\Wow6432Node\Mozilla\Mozilla Firefox ESR\CurrentVersion
.