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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.