How do I check Update Rollup version on Exchange 20xx Server?

Instead of updating my previous post which covers only Exchange 2007, I decided to create a new post which covers both versions.

Now that Update Rollup for Exchange Server 2010 is available, I have updated my previous script to check for Update Rollup versions on both Exchange Server 2007 and Exchange Server 2010. No need to have two versions of script. Just download this one!

Here’s what has changed between versions:

  • Product GUID has changed to AE1D439464EB1B8488741FFA028E291C (Exchange 2010) from 461C2B4266EDEF444B864AD6D9E5B613 (Exchange 2007).
  • Exchange writes installation information to HKLM\SOFTWARE\Microsoft\ExchangeServer\v14\Setup instead of “HKLM\SOFTWARE\Microsoft\Exchange\Setup”

The script below will do the work for you so you don’t need to remember what I just said above. Isn’t that what script is for?

# Store header in variable
$headerLine =
@"

Server Name,Rollup Update Description,Installed Date,ExSetup File Version
"@

# Write header to file
$headerLine | Out-File .\results.csv -Encoding ASCII -Append

function getRU()
{
# Set server to connect to
	$Server = "$_".ToUpper()


# Check if server is running Exchange 2007 or Exchange 2010

	$ExchVer = (Get-ExchangeServer $Server | ForEach {$_.AdminDisplayVersion.Major})

# Set appropriate base path to read Registry
# Exit function if server is not running Exchange 2007 or Exchange 2010
	if ($ExchVer -eq "8" -or $ExchVer -eq "14")
		{
			switch ($ExchVer)
			{
			 "14"	{
			 			$REG_KEY = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\AE1D439464EB1B8488741FFA028E291C\\Patches"
						$Reg_ExSetup = "SOFTWARE\\Microsoft\\ExchangeServer\\v14\\Setup"
			 		}
			 "8"	{
			 			$REG_KEY = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\461C2B4266EDEF444B864AD6D9E5B613\\Patches"
						$Reg_ExSetup = "SOFTWARE\\Microsoft\\Exchange\\Setup"
			 		}
			}
		}
	else
		{return}

# Read Rollup Update information from servers

# Set Registry constants
	$VALUE1 = "DisplayName"
	$VALUE2 = "Installed"
	$VALUE3 = "MsiInstallPath"

# Open remote registry
	$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $Server)

# Set regKey for MsiInstallPath
	$regKey= $reg.OpenSubKey($REG_ExSetup)

# Get Install Path from Registry and replace : with $
	$installPath = ($regkey.getvalue($VALUE3) | foreach {$_ -replace (":","`$")})

# Set ExSetup.exe path
	$binFile = "Bin\ExSetup.exe"

# Get ExSetup.exe file version
	$exSetupVer = ((Get-Command "\\$Server\$installPath$binFile").FileVersionInfo | ForEach {$_.FileVersion})

# Create an array of patch subkeys
	$regKey= $reg.OpenSubKey($REG_KEY).GetSubKeyNames() | ForEach {"$Reg_Key\\$_"}

# Walk through patch subkeys and store Rollup Update Description and Installed Date in array variables
	$dispName = [array] ($regkey | %{$reg.OpenSubKey($_).getvalue($VALUE1)})
	$instDate = [array] ($regkey | %{$reg.OpenSubKey($_).getvalue($VALUE2)})

# Loop Through array variables and output to a file
	$countmembers = 0

	if ($regkey -ne $null)
	{
		while ($countmembers -lt $dispName.Count)
		{
		$server+","+$dispName[$countmembers]+","+$instDate[$countmembers].substring(0,4)+"/"+$instDate[$countmembers].substring(4,2)+"/"+$instDate[$countmembers].substring(6,2)+","+$exsetupver | Out-File .\results.csv -Encoding ASCII -Append
		$countmembers++
		}
	}
	else
	{
		$server+",No Rollup Updates are installed,,"+$exsetupver | Out-File .\results.csv -Encoding ASCII -Append
	}
}

# Get Exchange 2007 servers and write Rollup Updates to results file
$Servers = (Get-ExchangeServer | Where-Object {($_.AdminDisplayVersion -match "8" -OR $_.AdminDisplayVersion -match "14") -AND $_.ServerRole -ne "ProvisionedServer" -and $_.ServerRole -ne "Edge"} | ForEach {$_.Name})
$Servers | ForEach {getRU}

Download – Get-ExchangeUpdateRollups.ps1

Print Friendly
Tagged . Bookmark the permalink.

13 Responses to How do I check Update Rollup version on Exchange 20xx Server?

  1. Pingback: Exchange Server : Installing Exchange 2010 rollups on DAG servers

  2. Nice script!

    hare is a similar script but different code

    http://postmaster.ge/blog/post/Getting-Exchange-Server-Update-Rollups.aspx

    p.s.
    you can use online translator, anyway powershell code is same on all languages :)

    Arman.

    ———————-

    Note from Bhargav:

    Nice work. Keep in mind my script addresses both version so you don’t need two separate scripts for Exchange 2007 and Exchange 2010. The script I wrote checks version and reads registry accordingly.

  3. Trevor says:

    Hey… thanks for this. I needed a script to run in our mixed 2007/2010 dev environment. This worked like a charm.

    I made a couple of simple changes to the script to make it more useful to us:

    1. removed the -Append option when writing the header so that it overwrites the output from any previous runs (don’t need to see those results)

    2. added last line to display the results back to the screen: get-content .\results.csv

  4. Pingback: Verify which Service Packs and Roll-ups are installed on your Exchange Server - Exchange 2010 - Pro-Exchange

  5. Paul Phillips says:

    I’m trying to figure out how to modify your script to work in my environment, but having problems. We use clusters and the script seems to make the assumption that the value returned for get-exchangeserver will be a physical server name. I’m not sure how to go about updating it to recurse out the individual server names from that.

    Any help greatly appreciated,
    Thanks
    Paul

  6. Kirk says:

    What is required to run these remotely? I have a “scripting server” setup to monitor the exchange invironment, I have always had issues running scripts that read the registry key that contains RU version.

  7. Robbie says:

    Hi this code looks perfiect for me, but can you tell me how could i scope this to a server or a set of servers instead of all servers in the or.

  8. Pingback: Welche Exchange-Updates sind installiert? « Es gibt 10 Arten von Menschen.

  9. Pingback: V1.1 of Exchange Environment Report script available now | Steve Goodman's Exchange Blog

  10. Pingback: PHP Scripts

  11. Pingback: Exchange 2010 Version Hunting « Just A UC Guy

  12. Pingback: Exchange Service Packs and Rollups – Up to Date or Not? « Just A UC Guy

  13. Pingback: Exchange Version Check – 2013 Cumulative Updates | Just A UC Guy

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>