Link to home
Start Free TrialLog in
Avatar of petrosyg
petrosyg

asked on

Deploy IE9 as a package - about 50% of our workstations have win7 with IE 8 the other half are IE 9. I would like to push IE9 but I want to check if IE 9 is present first.

I would like to Deploy IE9 as a package - We are not ready for WSUS yet...
about 50% of our workstations have win7 with IE 8 the other half are IE 9. I would like to push IE9 but I want to check if IE 9 is  present first.
Also, I would assume I have to consider OS architecture as well... I am not sure if I need to push IE9 32 Bit on both X86 and X64.

I know Rob Sampson has a similar script that will check if a program exist before deploying - and I tried to adjust it but failed miserably.

Any help will be appreciated ... and btw I am using system Center 2012 to push the package.

Thank you
Avatar of RobSampson
RobSampson
Flag of Australia image

Hi, if you download both the 32 and 64 bit versions, we can use those, depending on the system, and also only install them if the current version is less than 9.

This code should work, although I haven't test it.

Regards,

Rob.

Set objShell = CreateObject("WScript.Shell")

Const strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
strArchitecture = GetOSArchitecture(objWMIService)

If strArchitecture = 32 Then
	strMSI = "\\server\share\software\IE932bit.msi"
Else
	strMSI = "\\server\share\software\IE964bit.msi"
End If

Set objFSO = CreateObject("Scripting.FileSystemObject")
intVersion = objFSO.GetFileVersion(objShell.ExpandEnvironmentStrings("%PROGRAMFILES%") & "\Internet Explorer\iexplore.exe")
intVersion = Int(Left(intVersion, InStr(intVersion, ".") - 1))
If intVersion < 9 Then
	WScript.Echo "Current version is " & intVersion & ". Update will now install."
	objShell.Run "msiexec " & strMSI & " /qn /norestart", 1, True
Else
	WScript.Echo "Current version is " & intVersion & ". Update is not required."
End If

Function GetOSArchitecture(objRemote)
	' TITLE: GetOSArchitecture
	' DESCRIPTION: This function will use a WMI query to determine the system
	'	architecture of the target computer
	' INPUT:
	'	objRemote must be an object that is bound to the WMI service on the target machine
	'	Make a call such as Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
	'	and pass objWMI to this function
	' OUTPUT:
	'	A string value being 32 or 64
	Set colOS = objRemote.ExecQuery("SELECT OSArchitecture FROM Win32_OperatingSystem",, 48) 
    For Each objOS In colOS 
        intAddressWidth = objOS.OSArchitecture
    Next
    If intAddressWidth = "32-bit" Then intAddressWidth = 32
    If intAddressWidth = "64-bit" Then intAddressWidth = 64
    GetOSArchitecture = intAddressWidth
End Function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of petrosyg
petrosyg

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No problem.  Can you close it accepting my comment instead? That would close it immediately.

Glad to help.

Rob.
Avatar of petrosyg
petrosyg

ASKER

Great Solution Rob ... Thank you again for all your help.