• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

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
  • 2
  • 2
1 Solution
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.



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"
	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
	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
	'	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
	'	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
    If intAddressWidth = "32-bit" Then intAddressWidth = 32
    If intAddressWidth = "64-bit" Then intAddressWidth = 64
    GetOSArchitecture = intAddressWidth
End Function

Open in new window

petrosygAuthor Commented:
Thank you Rob, I am going to give it a shot and let you know asap.

Thank you
No problem.  Can you close it accepting my comment instead? That would close it immediately.

Glad to help.

petrosygAuthor Commented:
Great Solution Rob ... Thank you again for all your help.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now