Share via


Updated : Exchange version powershell script

Further to my blog post on April 30th, I have updated the powershell script to output in a more usable manner and also detect more information about your exchange servers…

ServerName TransportVer CASver StoreVer
SERVER1 08.01.0336.000 08.01.0336.000 Not Installed
SERVER2 08.01.0336.000 08.01.0336.000 Not Installed
SERVER3 08.01.0336.000 08.01.0336.002 Not Installed
SERVER4 08.01.0336.000 08.01.0336.002 Not Installed
SERVER5 08.01.0336.000 08.01.0336.002 Not Installed
SERVER6 08.01.0336.000 08.01.0336.002 Not Installed
SERVER7 08.01.0336.000 08.01.0336.000 Not Installed
SERVER8 08.01.0336.000 08.01.0336.000 Not Installed
SERVER9 08.01.0336.000 08.01.0336.002 Not Installed
SERVER10 08.01.0336.000 08.01.0336.002 Not Installed
SERVER11 08.01.0336.000 08.01.0336.002 Not Installed
SERVER12 08.01.0336.000 08.01.0336.002 Not Installed
SERVER13 Not Installed Not Installed 08.01.0336.000
SERVER14 08.01.0336.000 08.01.0336.002 Not Installed
SERVER15 08.01.0336.000 08.01.0336.002 Not Installed
SERVER16 08.01.0336.000 08.01.0336.002 Not Installed
SERVER17 08.01.0336.000 08.01.0336.002 Not Installed
SERVER18 Not Installed Not Installed 08.01.0336.000
SERVER19 08.01.0336.000 08.01.0336.002 Not Installed
SERVER20 08.01.0336.000 08.01.0336.002 Not Installed
SERVER21 08.01.0336.000 08.01.0336.002 Not Installed
SERVER22 08.01.0336.000 08.01.0336.002 Not Installed
SERVER23 08.01.0336.000 08.01.0336.000 Not Installed
SERVER24 08.01.0336.000 08.01.0336.000 Not Installed
SERVER25 08.01.0336.000 08.01.0336.000 Not Installed
SERVER26 08.01.0336.000 08.01.0336.000 Not Installed
SERVER27 08.01.0336.000 08.01.0336.000 Not Installed
SERVER28 08.01.0336.000 08.01.0336.000 Not Installed

Powershell Code…

$exservers = get-exchangeserver

function MakeData($server,$transportver,$casver,$storever) {

    $data1 = $server
    $data2 = $transportver
    $data3 = $casver
    $data4 = $storever

    $out = new-object psobject
    $out | add-member noteproperty ServerName $data1
    $out | add-member noteproperty TransportVer $data2
    $out | add-member noteproperty CASver $data3
    $out | add-member noteproperty StoreVer $data4
    write-output $out

}

foreach ($server in $exservers)
{

    #
    # We need to test for three occurrences here
    #

    # To get around cluster share scoping we need to query this via IP...
    $ping = new-object System.Net.NetworkInformation.Ping
    $reply = $ping.send("$server")

    if ($reply.status -ne "success")
    {
        #
        # Sometimes if the server is distant the first ping fails
        # this is just a last chance to see if its really down...
        #
        $reply = $ping.send("$server")
        $reply = $ping.send("$server")
    }

    $ipaddress = $reply.address

    if ($reply.status -eq "success")
    {

        #
        # Check Store Version
        #
        
        if (Test-Path -path "\\$ipaddress\c$\program files\microsoft\exchange server\bin\store.exe")
        {

            $storever = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("\\$ipaddress\c$\program files\microsoft\exchange server\bin\store.exe").Fileversion
        }
        else
        {
            $storever = "Not Installed"
        }

        #
        # Check Transport Version
        #

        if (Test-Path -path "\\$ipaddress\c$\program files\microsoft\exchange server\TransportRoles\data")
        {

            $transportver = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("\\$ipaddress\c$\program files\microsoft\exchange server\bin\EdgeTransport.exe").Fileversion
        }
        else
        {
            $transportver = "Not Installed"
        }

        #
        # Check Client Access Version
        #

        if (Test-Path -path "\\$ipaddress\c$\Program Files\Microsoft\Exchange Server\ClientAccess\Owa\Bin\Microsoft.Exchange.Clients.Owa.dll")
        {

            $casver = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("\\$ipaddress\c$\Program Files\Microsoft\Exchange Server\ClientAccess\Owa\Bin\Microsoft.Exchange.Clients.Owa.dll").Fileversion
        }
        else
        {
            $casver = "Not Installed"
        }

        MakeData $server $transportver $casver $storever

    }
    else
    {

    $transportver = "down"
    $casver = "down"
    $storever = "down"

    MakeData $server $transportver $casver $storever

    }
}

Posted by Neil Johnson , MCS UK, MCM Exchange 2007

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Looks like the parenthesis are in the wrong place, try this... if (Test-Path "$ipaddressc$Program FilesMicrosoft OfficeOffice12WINWORD.EXE") Neil.

  • Anonymous
    June 05, 2009
    The comment has been removed

  • Anonymous
    January 07, 2010
    The comment has been removed

  • Anonymous
    January 08, 2010
    I think I did miss the point, and for that I apologize.  If one is looking for output that has detailed RU info like: XYZSVECA01 [ClientAccess] [Enterprise] 8.0.535.0

  • 04/04/2008:  Update Rollup 1 for Exchange Server 2007 Service Pack 1 (KB945684) 8.1.263.1
  • 08/08/2009:  Update Rollup 9 for Exchange Server 2007 Service Pack 1 (KB970162) 8.1.393.1
  • 05/05/2009:  Update Rollup 7 for Exchange Server 2007 Service Pack 1 (KB960384) 8.1.359.2
  • 05/05/2008:  Update Rollup 2 for Exchange Server 2007 Service Pack 1 (KB948016) 8.1.278.2 XYZSVECA02 [ClientAccess] [Enterprise] 8.0.535.0
  • 04/04/2008:  Update Rollup 1 for Exchange Server 2007 Service Pack 1 (KB945684) 8.1.263.1
  • 05/05/2009:  Update Rollup 7 for Exchange Server 2007 Service Pack 1 (KB960384) 8.1.359.2
  • 05/05/2008:  Update Rollup 2 for Exchange Server 2007 Service Pack 1 (KB948016) 8.1.278.2 ...then I believe this is the detail you were looking for. Notice you get the server name, role, build number, date RU applied, RU version and KB number. I have to give credit to Paul Flaherty at blogs.flaphead.com and Jeff Guillet at www.expta.com for compiling the script... It works flawlessly in my organization. It is called get-exchangeserverplus.ps1.  I will post it here with your permission. Neil, I do commend you for a fantastically brilliant script. As with any script, there are 100 ways to do things.  So do not think I think badly of your efforts.  Quite the contrary sir! For the novice who reads this, I was never able to script well in VB.  I just didn't ever have the time to invest in learning it. PowerShell however is easy to learn, and playing with it has proven to be fun. I consider myself a newbie to PowerShell, and simply using the cmdlets has been cool, as each one gives you results.  Writing an actual script was a huge event for me!! Keep up the good work and I look forward to more software packages becoming PowerShell ready, especially SharePoint and Citrix. gb Austin, TX USA