You are on page 1of 2

'==================================================================================

==
' Adobe Flash Player 18 Install.vbs
' Created by: Archana Ambrish
' For Loblaw Companies Ltd.
' For Internal Use Only
' Date: 12-Aug-2015
'==================================================================================
==
On error resume next
Dim objWMIService, objOperatingSystem, colOperatingSystems
Dim OSVersion, OSVersion3digit
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _


("Select * from Win32_OperatingSystem")

set WshShell = WScript.CreateObject("WScript.Shell")


Set oFSO = CreateObject("Scripting.FileSystemObject")
ScriptPath = Left(Wscript.ScriptFullName, (InstrRev(Wscript.ScriptFullName, "\") -
1))

sYsDr = WshShell.ExpandEnvironmentStrings("%SystemDrive%")
PrfDr = WshShell.ExpandEnvironmentStrings("%ProgramFiles%")
PrfDr86 = WshShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")
StrflashproductVersion = "18.0.0.209"
'******************************************************** FOR IE Browser
****************************************************************************

If oFSO.fileExists(PrfDr & "\Internet Explorer\iexplore.exe") OR


oFSO.fileExists(PrfDr86 & "\Internet Explorer\iexplore.exe") Then

ActiveX = "MSIEXEC /I " chr(34) & ScriptPath & "\Activex\


install_flash_player_18_active_x.msi" & chr(34) & chr(32) & "TRANSFORMS=" & chr(34)
& ScriptPath & "\Activex\install_flash_player_18_active_x.mst" & chr(34) & " /qb!-"
WSHShell.Run ActiveX,0,True

End If

'******************************************************* For Non IE Browsers


*****************************************************************************

If oFSO.fileExists(PrfDr & "\Google\Chrome\Application\chrome.exe") OR


oFSO.fileExists(PrfDr86 & "\Google\Chrome\Application\chrome.exe") Then

Flash = "MSIEXEC /I " chr(34) & ScriptPath & "\Activex\


install_flash_player_18_active_x.msi" & chr(34) & chr(32) & "TRANSFORMS=" & chr(34)
& ScriptPath & "\Activex\install_flash_player_18_active_x.mst" & chr(34) & " /qb!-"
WSHShell.Run Flash,0,True

Else
'*****************************************************For Firefox Browser
***********************************************************************************

'Check firefox is present -


If oFSO.fileExists(PrfDr & "\Mozilla Firefox\firefox.exe") OR
oFSO.fileExists(PrfDr86 & "\Mozilla Firefox\firefox.exe") Then

'Check is flash player is already installed -

StrFlashInstalled = RegistryKeyExistsVal("HKEY_LOCAL_MACHINE","SOFTWARE\Microsoft\
Windows\CurrentVersion\Uninstall\Adobe Flash Player 18 NPAPI", "DisplayVersion")
StrFlashInstalled64 = RegistryKeyExistsVal("HKEY_LOCAL_MACHINE","SOFTWARE\
WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player 18
NPAPI", "DisplayVersion")

'Check if it is not installed then install the Flashplayer -

If Not (StrFlashInstalled = StrflashproductVersion) or (StrFlashInstalled64 =


StrflashproductVersion)
Flash = "MSIEXEC /I " chr(34) & ScriptPath & "\Activex\
install_flash_player_18_active_x.msi" & chr(34) & chr(32) & "TRANSFORMS=" & chr(34)
& ScriptPath & "\Activex\install_flash_player_18_active_x.mst" & chr(34) & " /qb!-"
WSHShell.Run Flash,0,True

End IF

End IF

'*****************************************************************************
' Read a string value in registry
'*****************************************************************************
Function RegistryKeyExistsVal(LNGHKEY, strKey, strSubkey)

Dim reg, valueobt


Set reg = GetObject("WinMgmts:{impersonationLevel=impersonate}!\\.\root\
default:StdRegProv")
reg.GetStringValue LNGHKEY,strKey,strSubkey,valueobt

If Not IsNull(valueobt) Then


RegistryKeyExistsVal = valueobt
End If
End Function

You might also like