Schlagwort-Archive: microsoft exchange

check the version including update rollup of all Exchange servers in organization

After I realized that there is no Exchange 2010 cmdlet to determine the complete version number of all Exchange servers, I decided to write a script for this.

The result is one ps1 script and a csv file with the version numbers and the version name. I got the version informations from this Article.

The version csv looks like this:

Version,Text
"14.0.639.21","Microsoft Exchange Server 2010 RTM"
"14.0.682.1","Microsoft Exchange Server 2010 RTM Update Rollup 1"
"14.0.689.0","Microsoft Exchange Server 2010 RTM Update Rollup 2"
.........
"14.3.210.2","Microsoft Exchange Server 2010 SP3 Update Rollup 7"
"14.3.224.2","Microsoft Exchange Server 2010 SP3 Update Rollup 8-v2"

To check the version, the script gets the installation path from registry and reads the file info of the exsetup.exe via smb (admin shares).

And this is the script:

# read versions and versiontext from csv
$versions = @{}
$csvversions = (Import-Csv -Path .\get-ExchangeServerVersion.csv)
$csvversions | foreach { $versions[($_.version)] = $_.Text }

# create list object for output
$output = @()

$version ="UNKNOWN!"

# get exchange servers in the organization filtered by version 14.*
$exServers = Get-ExchangeServer | ? { $_.AdminDisplayVersion -like "Version 14.*"} | sort fqdn | select name,fqdn
foreach ($exServer in $exServers){
    Write-Debug $exserver
    # create PowerShell object for output line
    $outputEx = New-Object -TypeName PSObject

    # get Exchange installation path
    $Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $exServer.fqdn)
    $RegKey= $Reg.OpenSubKey("SOFTWARE\\Microsoft\\ExchangeServer\\V14\\Setup")
    $InstallPath = $RegKey.GetValue("MsiInstallPath")
    $ExSetupPath=("\\"+$exServer.fqdn+"\"+($InstallPath).replace(":\","$\").Replace("""",""))+"bin\ExSetup.exe"

    # get Version from Exchange binary
    $version = ([Version](Get-Item ($ExSetupPath)).VersionInfo.ProductVersion).tostring()

    # add server name to ps object
    Add-Member -InputObject $outputEx -MemberType NoteProperty -Name Name -Value $exServer.fqdn

    # add version to ps object, if the version is not in the version list, use the version instead of text
    If($versions["$($version)"]){
        Add-Member -InputObject $outputEx -MemberType NoteProperty -Name Version -Value $versions["$($version)"]
    } else {
        Add-Member -InputObject $outputEx -MemberType NoteProperty -Name Version -Value $version
    }

    # reset Version to unknown for next loop
    $version ="UNKNOWN!"
    $ExSetupPath = ""

    # add ps object to output
    $output+=$outputEx

}
$output

downloads

get-ExchangeServerVersion.ps1
get-ExchangeServerVersion.csv