PoshCode Logo PowerShell Code Repository

IE11 Install by teste 7 months ago (modification of post by BattleChicken view diff)
diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/6522"></script>download | new post

I wrote this to install IE11 through Altiris. Though the install method works fine without using Altiris. The script installs all of the KB prerequisite and recommended updates for IE 11, which are specified in $updateMSUs for the x86 and x64 blocks of code. It then installs IE 11 without forcing a reboot.

  1. <#
  2. Requisite updates for IE11 installation on Microsoft Windows 7 x86 and x64 (Please see http://support.microsoft.com/kb/2847882)
  3.  
  4.     1. KB2729094 (http://support.microsoft.com/kb/2729094)
  5.     2. KB2731771 (http://support.microsoft.com/kb/2731771)
  6.     3. KB2533623 (http://support.microsoft.com/kb/2533623)
  7.     4. KB2670838 (http://support.microsoft.com/kb/2670838)
  8.     5. KB2786081 (http://support.microsoft.com/kb/2786081)
  9.     6. KB2834140 (http://support.microsoft.com/kb/2834140)
  10.  
  11. Optional updates for IE11 installation on Microsoft Windows 7 x86 and x64
  12.  
  13.     1. KB2639308 (http://support.microsoft.com/kb/2639308)
  14.     2. KB2888049 (http://support.microsoft.com/kb/2888049)
  15.     3. KB2882822 (http://support.microsoft.com/kb/2882822)
  16. #>
  17.  
  18. # Check if IE is already version 11.  If it is, do nothing.
  19. $targetIEVer = 11
  20. $x64IEPath = "C:\Program Files\Internet Explorer\iexplore.exe"
  21. $x86IEPath = "C:\Program Files (x86)\Internet Explorer\iexplore.exe"
  22. if (([int](get-item $x64IEPath).VersionInfo.productVersion.split('.')[0] -ge $targetIEVer) -or ([int](get-item $x86IEPath).VersionInfo.productVersion.split('.')[0] -ge $targetIEVer)){
  23.     Write-Host "IE11 Already installed - no action taken"
  24. }
  25. else{
  26.  
  27.     $fileroot = split-path $script:MyInvocation.MyCommand.Path -parent # sets the target directory to where the .ps1 is.
  28.     $os = (Get-WmiObject Win32_OperatingSystem -computername localhost).OSArchitecture
  29.     try {
  30.         if ($os -eq "32-Bit" -and (Test-Path $fileroot) -eq $true)
  31.         {
  32.  
  33.             Write-Host "Found 32-Bit Architecture...Installing pre-requisite updates..."
  34.  
  35.             #Prerequisite Patches
  36.             $updateMSU = @(
  37.                 "Windows6.1-KB2533623-x86.msu",
  38.                 "Windows6.1-KB2888049-x86.msu",
  39.                 "Windows6.1-KB2670838-x86.msu",
  40.                 "Windows6.1-KB2729094-v2-x86.msu",
  41.                 "Windows6.1-KB2731771-x86.msu",
  42.                 "Windows6.1-KB2786081-x86.msu",
  43.                 "Windows6.1-KB2834140-v2-x86.msu",
  44.                 "Windows6.1-KB2882822-x86.msu",
  45.                 "Windows6.1-KB2639308-x86.msu"
  46.             )
  47.             $ie32 =  "EIE11_EN-US_MCM_WIN7.EXE" #Installer
  48.  
  49.             foreach ($updateMSU in $updateMSUs){
  50.                 Write-Host "Installing Update $updateMSU..."
  51.                 Start-Process "wusa.exe" -ArgumentList @("""$fileroot\$updateMSU""","/quiet","/norestart") -Wait -Verbose
  52.             }
  53.  
  54.             Write-Host "Stopping any active IE processes..."
  55.             get-process iexplore -ErrorAction silentlycontinue | Stop-Process -ErrorAction SilentlyContinue
  56.             Write-Host "Installing Internet Explorer 11, 32-bit...Please Wait"
  57.             Start-Process "$fileroot\$ie32" -ArgumentList @("/passive","/update-no","/norestart") -Wait -verbose
  58.  
  59.             Exit 0
  60.  
  61.         }
  62.     }
  63.     catch {
  64.         throw "Error installing IE 11"
  65.     }
  66.  
  67.     #######################################################################################
  68.     #                                IE 64-bit Routine
  69.     #######################################################################################
  70.     try{
  71.         if ($os -eq "64-Bit" -and (Test-Path $fileroot) -eq $true)
  72.         {
  73.             Write-Host "Found 64-Bit Architecture...Installing pre-requisite updates..."
  74.  
  75.             #prerequisite patches
  76.             $updateMSUs = @(
  77.                 "Windows6.1-KB2533623-x64.msu",
  78.                 "Windows6.1-KB2888049-x64.msu",
  79.                 "Windows6.1-KB2670838-x64.msu",
  80.                 "Windows6.1-KB2729094-v2-x64.msu",
  81.                 "Windows6.1-KB2786081-x64.msu",
  82.                 "Windows6.1-KB2834140-v2-x64.msu",
  83.                 "Windows6.1-KB2882822-x64.msu",
  84.                 "Windows6.1-KB2639308-x64.msu"
  85.             )
  86.             $ie64 = "IE11-Windows6.1-x64-en-us.exe" #Installer
  87.  
  88.             foreach ($updateMSU in $updateMSUs){
  89.                 Write-Host "Installing Update $updateMSU..."
  90.                 Start-Process "wusa.exe" -ArgumentList @("""$fileroot\$updateMSU""","/quiet","/norestart") -Wait -Verbose
  91.             }
  92.  
  93.  
  94.             Write-Host "Stopping any active IE processes..."
  95.             get-process iexplore -ErrorAction silentlycontinue | Stop-Process -ErrorAction SilentlyContinue
  96.             Write-Host "Installing Internet Explorer 11, 64-Bit, Please wait..."
  97.             Start-Process "$fileroot\$ie64" -ArgumentList @("/passive","/update-no","/norestart") -Wait -verbose
  98.             if ($?){Write-Host "Install complete"}
  99.             Exit 0
  100.         }
  101.     }
  102.     catch {
  103.             throw "Error installing IE 11"
  104.     }
  105. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me