Exchange 2007 Update Rollups

So as you have read I have been playing with the two Update Rollups (1, 2)and the one things that gets me is that you have no way of knowing what patches are applied on what servers.

Until now ;-) So I have written some PowerShell that will get a list of all your Exchange 2007 with the exception of Edge servers.  It then uses WMI to connect to the servers registry and dump the Patches Registry key.  You can see the key here:

HKLMSOFTWAREMicrosoftWindowsCurrentVersionInstallerUserDataS-1-5-18Products461C2B4266EDEF444B864AD6D9E5B613Patches

So the output looks like this:

[PS] C:PS>.Get-ExchangeServerPlus.ps1

CAS01 [ClientAccess] [Standard] 8.0.535.0
– 20070418:  Update Rollup 1 for Exchange Server 2007 (KB930809) 8.0.708.3

CAS02 [ClientAccess] [Standard] 8.0.535.0
– 20070509:  Update Rollup 2 for Exchange Server 2007 (KB935490) 8.0.711.2

HUB01 [HubTransport] [Standard] 8.0.535.0
– 20070419:  Update Rollup 1 for Exchange Server 2007 (KB930809) 8.0.708.3
– 20070509:  Update Rollup 2 for Exchange Server 2007 (KB935490) 8.0.711.2

HUB02 [HubTransport] [Standard] 8.0.535.0
– 20070419:  Update Rollup 1 for Exchange Server 2007 (KB930809) 8.0.708.3

MBX01 [Mailbox] [Enterprise] 8.0.535.0
– 20070418:  Update Rollup 1 for Exchange Server 2007 (KB930809) 8.0.708.3

MBX03 [Mailbox] [Standard] 8.0.535.0
– 20070424:  Update Rollup 1 for Exchange Server 2007 (KB930809) 8.0.708.3

[PS] C:PS>

Here is the code,  I need to sort out a bit or error handling but it works!


#Get-ExchangeServerPlus.ps1
#v1.0 9th May 2007
#Written By Paul Flaherty
#blogs.flaphead.com

#Get a list of Exchange Server in the Org excluding Edge servers
$MsxServers = Get-ExchangeServer | where {$_.ServerRole -ne “Edge”} | sort Name

#Loop each Exchange Server that is found
ForEach ($MsxServer in $MsxServers)
{

    #Get Exchange server version
    $MsxVersion       = $MsxServer.ExchangeVersion

    #Create “header” string for output
    # Servername [Role] [Edition] Version Number
    $txt1 = $MsxServer.Name + ” [” + $MsxServer.ServerRole + “] [” + $MsxServer.Edition + “] ” + $MsxVersion.ExchangeBuild.toString()
    write-host $txt1

    #Connect to the Server’s remote registry and enumerate all subkeys listed under “Patches”
    $Srv = $MsxServer.Name
    $key = “SOFTWAREMicrosoftWindowsCurrentVersionInstallerUserDataS-1-5-18Products461C2B4266EDEF444B864AD6D9E5B613Patches”
    $type = [Microsoft.Win32.RegistryHive]::LocalMachine
    $regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($type, $Srv)
    $regKey = $regKey.OpenSubKey($key)

    #Loop each of the Subkeys (Patches) and gather the Installed date and Displayname of the Exchange 2007 patch
    Foreach($sub in $regKey.GetSubKeyNames())
    {
        Write-Host “- ” -nonewline
        $SUBkey = $key + $Sub
        $SUBregKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($type, $Srv)
        $SUBregKey = $SUBregKey.OpenSubKey($SUBkey)

        Foreach($SubX in $SUBRegkey.GetValueNames())
        {
            # Display Installed date and Displayname of the Exchange 2007 patch
            IF ($Subx -eq “Installed”)   {Write-Host $SUBRegkey.GetValue($SubX) -NoNewLine}
            IF ($Subx -eq “DisplayName”) {write-Host “: “$SUBRegkey.GetValue($SubX)}
        }
    }
        write-host “”
}

 

I will upload the zip in a couple of hours when I get home and this link will become alive 

Hope this helps.   Let me know if you have any feedback

Leave a Reply

%d bloggers like this: