Pro-Exchange,Lync & Office 365
Belgian Microsoft Unified Communications Professionals
Microsoft Exchange Server, Microsoft Lync Server & Office 365
Script: check what version of Exchange 2010 you are running

I've noticed that quite some search phrases in Google were about how to determine what version or build of Exchange (2010) you're running. That is why, a while back, I decided to make a little script which does that for you. I updated the syntax a bit (more compact) and added new Exchange version numbers.

At the moment, the script is limited to Exchange 2010, but you could easily modify it to include support for earlier versions of Exchange as well.

Note that I'm not a scripting-guru and that the script's function is limited to Exchange 2010 only. For more information, you can always contact me directly. Feedback is always welcome!

To run the script, you just have to run "Get-ExchangeVersion" once you've loaded into your profile. To do so, you can dot-script this script by typing ". .\scriptname.ps1" from EMS.

Here's the code:

<#
Michael Van Horenbeeck
Version-checker for Exchange 2010
v1.0 28/02/2011
 
Updates
v1.1 17/07/2011 - Added new builds to the $versionArray
v1.2 09/09/2011 - Added UR4 v2 to the $versionArray
 
Additional Information
This script is designed to only work with Exchange Server 2010.
If you want to add support for earlier versions of exchange there are some things that need to be done:
   - add version info to $versionArray
   - lookup version info from exsetup.exe in different location (based on what version you're running)
 
The script needs to be run with enough rights in order to use administrative shares and lookup file version info
Additionally, the exchange server should be reachable from the computer you are using to run the script.
#>
 
function Get-ExchangeVersion{
    #define variables
    $var = @()
    $info = @()
    $obj=@()
    $servers = Get-ExchangeServer
    $i=0
    #additional settings
    Set-ADServerSettings -ViewEntireForest $true
    #List of Version numbers
    #format:("Name","buildnr")
    $versionArray = ("Exchange Server 2010 RTM","14.00.0639.021"),
                    ("Exchange Server 2010 Update Rollup 1","14.00.0682.001"),
                    ("Exchange Server 2010 Update Rollup 2","14.00.0689.000"),
                    ("Exchange Server 2010 Update Rollup 3","14.00.0694.000"),
                    ("Exchange Server 2010 Update Rollup 4","14.00.0702.001"),
                    ("Exchange Server 2010 Update Rollup 5","14.00.0726.000"),
                    ("Exchange Server 2010 SP1 RTM","14.01.0218.015"),
                    ("Exchange Server 2010 SP1 Update Rollup 1","14.01.0255.002"),
                    ("Exchange Server 2010 SP1 Update Rollup 2","14.01.0270.001"),
                    ("Exchange Server 2010 SP1 Update Rollup 3","14.01.0289.003"),
                    ("Exchange Server 2010 SP1 Update Rollup 3 v3","14.01.0289.007"),
                    ("Exchange Server 2010 SP1 Update Rollup 4","14.01.0323.001"),
                    ("Exchange Server 2010 SP1 Update Rollup 4 v2","14.01.0323.006")
       
       
    #Welcome message
    Write-Host ""
    Write-Host ""
    Write-Host "Exchange 2010 Version Checker v1.2"
    Write-Host "----------------------------------"
    Write-Host "The script is determining what versions of Exchange 2010 you are running. Please wait..."
    Write-Host ""
 
    #run trhough the array of exchange servers to determine build
    foreach ($server in $servers){
    
        $var+= Get-ExchangeServer $server
        $role = $var[$i].ServerRole
       
        #The script uses the default installation directory + administrative share. If one (or both) has changed (e.g. no administrative share available or you installed in another directory)
        #please, update the variable $fileinfo with the correct information
        $fileinfo = Get-Command "
\\$server\c$\program files\microsoft\exchange server\v14\bin\exsetup.exe" | %{$_.fileversioninfo}
   
        $version = $fileinfo.FileVersion
        $major = $fileinfo.FileMajorPart
   
        for($n=0;$n -lt $versionArray.count; $n++){
            if($version -eq $versionArray[$n][1]){
               $obj = New-Object PSObject
               $obj | Add-Member -type NoteProperty -name Name -value $server
               $obj | Add-Member -type NoteProperty -name Roles -value $role
               $obj | Add-Member -type NoteProperty -name VersionName -value $versionArray[$n][0]
               $info += $obj
            }
        }
    
        $i++
        $n=0
    }
 
    Write-Output $info | ft -autosize
   
    Write-Host ""
    Write-Host ""
}

If you are interested in a more complete (and complex) script, which gives you a nice overview of your entire Exchange organization, please take a look at:

If you want to get to know more about powershell, visit:


Posted 08-09-2011 12:37 by Michael Van Horenbeeck