Thursday, August 26, 2010

Silent Internet Explorer 8 installation

Here's the script I wrote to silently install IE8.

The simple command line to use would be : "IE8-WindowsXP-x86-ENU.exe /passive /norestart" (for Internet Explorer Setup Options look here) but we want the script to do more and to automatically detect Windows OS version.

Start by download all these files from microsoft.com and put them in the very same directory:

  • IE8-WindowsXP-x86-enu.exe for XP 32 bits
  • IE8-WindowsVista-x86-ENU.exe for Vista 32 bits and Windows Server 2008 32 bits
  • IE8-WindowsVista-x64-ENU.exe for Vista 64 bits and Windows Server 2008 64 bits
  • IE8-WindowsServer2003-x86-ENU.exe for Win 2003 32 bits SP2
  • IE8-WindowsServer2003-x64-enu.exe for Windows 2003 64 bits and Windows XP Pro 64 bits

Two script are needed:

  • IE8_install.bat
  • IE8.kix

Here's the content of IE8_install.bat

@echo OFF
IF NOT EXIST %WINDIR%\system32\kix32.exe (
@echo Please check that you have %WINDIR%\system32\kix32.exe
pause
) ELSE (
@echo ON
kix32 IE8.kix
)

And here it come the kix script IE8.kix:

;Enter the directory of the current script
cd @SCRIPTDIR\

;Association of OS version to installation file
;CASE is the function we need here
SELECT
CASE @PRODUCTTYPE = "Windows XP Home Edition"
$Install = "IE8-WindowsXP-x86-enu.exe"
CASE @PRODUCTTYPE = "Windows XP Media Center Edition"
$Install = "IE8-WindowsXP-x86-enu.exe"
CASE @PRODUCTTYPE = "Windows XP Professional"
IF @ONWOW64 = 1
$Install = "IE8-WindowsServer2003-x64-enu.exe"
ELSE
$Install = "IE8-WindowsXP-x86-enu.exe"
ENDIF
CASE @PRODUCTTYPE = "Windows Server 2003"
IF @ONWOW64 = 1
$Install = "IE8-WindowsServer2003-x64-ENU.exe"
ELSE
$Install = "IE8-WindowsServer2003-x86-ENU.exe"
ENDIF
CASE @PRODUCTTYPE = "Windows Server 2003 Domain Controller"
IF @ONWOW64 = 1
$Install = "IE8-WindowsServer2003-x64-ENU.exe"
ELSE
$Install = "IE8-WindowsServer2003-x86-ENU.exe"
ENDIF
CASE @PRODUCTTYPE = "Windows Server 2003 R2"
IF @ONWOW64 = 1
$Install = "IE8-WindowsServer2003-x64-ENU.exe"
ELSE
$Install = "IE8-WindowsServer2003-x86-ENU.exe"
ENDIF
CASE @PRODUCTTYPE = "Windows Server 2003 R2 Domain Controller"
IF @ONWOW64 = 1
$Install = "IE8-WindowsServer2003-x64-ENU.exe"
ELSE
$Install = "IE8-WindowsServer2003-x86-ENU.exe"
ENDIF
CASE @PRODUCTTYPE = "Windows Vista Home Edition"
IF @ONWOW64 = 1
$Install = "IE8-WindowsVista-x64-ENU.exe"
ELSE
$Install = "IE8-WindowsVista-x86-ENU.exe"
ENDIF
CASE @PRODUCTTYPE = "Windows Vista Home Edition"
IF @ONWOW64 = 1
$Install = "IE8-WindowsVista-x64-ENU.exe"
ELSE
$Install = "IE8-WindowsVista-x86-ENU.exe"
ENDIF
CASE @PRODUCTTYPE = "Windows Vista Home Edition"
IF @ONWOW64 = 1
$Install = "IE8-WindowsVista-x64-ENU.exe"
ELSE
$Install = "IE8-WindowsVista-x86-ENU.exe"
ENDIF
CASE @PRODUCTTYPE = "Windows Vista Professional"
IF @ONWOW64 = 1
$Install = "IE8-WindowsVista-x64-ENU.exe"
ELSE
$Install = "IE8-WindowsVista-x86-ENU.exe"
ENDIF
CASE @PRODUCTTYPE = "Windows Vista Media Center Edition"
IF @ONWOW64 = 1
$Install = "IE8-WindowsVista-x64-ENU.exe"
ELSE
$Install = "IE8-WindowsVista-x86-ENU.exe"
ENDIF
CASE @PRODUCTTYPE = "Windows Vista Server"
IF @ONWOW64 = 1
$Install = "IE8-WindowsVista-x64-ENU.exe"
ELSE
$Install = "IE8-WindowsVista-x86-ENU.exe"
ENDIF
CASE @PRODUCTTYPE = "Windows Vista Domain Controller"
IF @ONWOW64 = 1
$Install = "IE8-WindowsVista-x64-ENU.exe"
ELSE
$Install = "IE8-WindowsVista-x86-ENU.exe"
ENDIF
ENDSELECT

;Starting installation process
$do_it = '$Install /passive /norestart'
? $do_it
shell '%COMSPEC% /c ' + $do_it
SELECT
CASE @ERROR = 0
?"INSTALLATION SUCCEDED"
CASE @ERROR = 3010
?"PLEASE REBOOT NOW"
CASE 1
? "Error " + @ERROR
GOTO "failed"
ENDSELECT

GOTO "done"

:failed
? "SCRIPT FAILED"

:fin
? "END OF SCRIPT"

Hope it helps!

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...