Exchange Server 2013 Prerequisite Script *Updated*

A while back I wrote a script to install Exchange 2013 Prerequisites on Windows 2008 R2 and Windows 2012. This script has grown and expanded over time to include support for newer CU’s, Edge Transport Role, ETC. This version I’ve made some changes, cleaned up some code and basically made it more compatible for Exchange 2013 CU7+: .NET is now 4.5.2 (not 4.5.0), Windows Framework 4.0 has been added, Office 2010 SP2 Filter Pack as well as checks for the Edge Transport Role.

Key changes are for .NET and Windows Framework. The update to .NET 4.5.2 should be done due to a recent KB article on the performance issues that affect Exchange with .NET 4.5. Per Microsoft the underlying cause was:

“This issue occurs because too many objects are pinned on the .NET Framework 4.5 garbage collector heap. It causes heap fragmentation in addition to an increase in CPU and memory usage by the garbage collector.”

The Windows Framework check is because Exchange 2013 SP1 and greater rely on a the new version according to Microsoft’s Exchange Server prerequisite documentation.

Below are the code sections that have been updated for those that are curious:

New Check for .NET 4.5.2:

# .NET 4.5.2
	$val = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -Name "Release"
	if($val.Release -lt "379893") {
		write-host ".NET 4.5.2 is " -nonewline 
		write-host "not installed!" -ForegroundColor red
	}
	else {
		write-host ".NET 4.5.2 is " -nonewline
		write-host "installed." -ForegroundColor green
	}

New check for Framework 4.0.

# Windows Management Framework 4.0 - Check - Needed for CU3+
	$wmf = $PSVersionTable.psversion
	if ($wmf.major -ge "4") {
    	Write-Host "Windows Management Framework 4.0 is " -nonewline 
	    write-host "installed." -ForegroundColor green
	} else {
	write-host "Windows Management Framework 4.0 is " -nonewline 
	write-host "not installed!" -ForegroundColor red
	}

New check for Office 2010 Filter Pack 2.

     # Office 2010 SP2 Filter Pack
	$val = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{95140000-2000-0409-1000-0000000FF1CE}" -Name "DisplayVersion" -erroraction silentlycontinue
	if($val.DisplayVersion -ne "114.0.7015.1000"){
	write-host "Office 2010 SP2 Filter Pack is " -nonewline 
	write-host "not installed!" -ForegroundColor red
	}
	else {
	write-host "Office 2010 SP2 Filter Pack is " -nonewline 
	write-host "installed." -ForegroundColor green
	}

New Check for the Edge Transport Role

     # Windows Feature AD LightWeight Services
	$values = @("ADLDS")
	foreach ($item in $values){
		$val = get-Windowsfeature $item
		If ($val.installed -eq $true){
			write-host "The Windows Feature"$item" is " -nonewline 
			write-host "installed." -ForegroundColor green
		}else{
			write-host "The Windows Feature"$item" is " -nonewline 
			write-host "not installed!" -ForegroundColor red
		}
	}

The new source code for the feature installs are as follows:
Windows Management Framework 4.0:

# Function - Windows Management Framework 4.0 - Install - Needed for CU3+
function Install-WinMgmtFW4{
    # Windows Management Framework 4.0
	$wmf = $PSVersionTable.psversion
	if ($wmf.major -eq "4") {
	    	Write-Host "`nWindows Management Framework 4.0 is already installed" -Foregroundcolor Green
	} else {
	    	GetIt "http://download.microsoft.com/download/3/D/6/3D61D262-8549-4769-A660-230B67E15B25/Windows8-RT-KB2799888-x64.msu"
    		Set-Location $targetfolder
	    	[string]$expression = ".\Windows8-RT-KB2799888-x64.msu /quiet /norestart"
	    	Write-Host "File: Windows8-RT-KB2799888-x64 installing..." -NoNewLine
	    	Invoke-Expression $expression
    		Start-Sleep -Seconds 20
		$wmf = $PSVersionTable.psversion
	
	    	if ($wmf.major -ge "4") {Write-Host "`b`b`b`b`b`b`b`b`b`b`b`b`binstalled!   " -Foregroundcolor Green} else {Write-Host "`b`b`b`b`b`b`b`b`b`b`b`b`bFAILED!" -Foregroundcolor Red}
    }
} # end Install-WinMgmtFW4

.Net 4.5.2:

# Function - .NET 4.5.2 [for CU7 +]
function Install-DotNET452{
    # .NET 4.5.2
	$val = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -Name "Release"
	if ($val.Release -lt "379893") {
    		GetIt "http://download.microsoft.com/download/E/2/1/E21644B5-2DF2-47C2-91BD-63C560427900/NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
	    	Set-Location $targetfolder
    		[string]$expression = ".\NDP452-KB2901907-x86-x64-AllOS-ENU.exe /quiet /norestart /l* $targetfolder\DotNET452.log"
	    	Write-Host "File: NDP452-KB2901907-x86-x64-AllOS-ENU.exe installing..." -NoNewLine
    		Invoke-Expression $expression
    		Start-Sleep -Seconds 20
    		Write-Host "`n.NET 4.5.2 is now installed" -Foregroundcolor Green
	} else {
    		Write-Host "`n.NET 4.5.2 already installed" -Foregroundcolor Green
    }
} # end Install-DotNET452

Office 2010 SP2 Filter Pack (includes the base install as well):

function Install-FilterPack{
    # Office filter pack & SP2
   if ((Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{95140000-2000-0409-1000-0000000FF1CE}") -eq $false){
    	GetIt "http://download.microsoft.com/download/0/A/2/0A28BBFA-CBFA-4C03-A739-30CCA5E21659/FilterPack64bit.exe"
    	Set-Location $targetfolder
    	[string]$expression = ".\FilterPack64bit.exe /quiet /norestart /log:$targetfolder\FilterPack64bit.log"
    	Write-Host "File: FilterPack64bit.exe installing..." -NoNewLine
    	Invoke-Expression $expression
    	Start-Sleep -Seconds 2
    	Write-Host "`nOffice filter pack is now installed" -Foregroundcolor Green
    }else{
    	Write-Host "`nOffice filter pack already installed" -Foregroundcolor Green}
     $val = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{95140000-2000-0409-1000-0000000FF1CE}" -Name "DisplayVersion" -erroraction silentlycontinue
     if($val.DisplayVersion -ne "14.0.7015.1000"){
	GetIt "http://download.microsoft.com/download/D/C/A/DCA32A51-6954-4814-8838-422BD3F508F8/filterpacksp2010-kb2687447-fullfile-x64-en-us.exe"
    	Set-Location $targetfolder
    	[string]$expression = ".\filterpacksp2010-kb2687447-fullfile-x64-en-us.exe /quiet /norestart /log:$targetfolder\FilterPack64bit.log"
    	Write-Host "File: filterpacksp2010-kb2687447-fullfile-x64-en-us.exe installing..." -NoNewLine
    	Invoke-Expression $expression
    	Start-Sleep -Seconds 20
	Write-Host "`nOffice filter pack SP1 is now installed" -Foregroundcolor Green
	}
     else {
	Write-Host "`nOffice filter pack SP1 already installed" -Foregroundcolor Green
    	}
} # end Install-FilterPack

The script is now in the range of 1400-1500 lines of code. I hope the updates are useful for those either updating to CU7 or installing new/greenfield CU7 servers. You can download the script either by click on the My Contributions button on the right side of my blog, or on this link.

Further Reading
Determing .NET Version
Exchange Server 2013 Requirements
Windows Management Framework (PowerShell) Version Check

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s