Skip to main content

Extracting the Exchange 2010 version number for a server

 Extracting the Exchange 2010 version number for a server



I was asked the other day what the best method is to retrieve information about the build version for Exchange 2010 that’s installed on a server. There are two ways of approaching the problem. You can either fetch the information that’s stored on the server itself or you can interrogate the Active Directory to fetch the version information that’s stored for each server in the Microsoft Exchange container in the configuration naming context. Build information is updated by the Exchange Setup program each time it successfully runs on a server.
The first place to look is on the server itself. The Exchange Setup program updates the system registry with build information and I had this piece of PowerShell code floating around – I have no doubt that its genesis is somewhere in an email discussion – and thought that it would be good to share. The code to fetch the build information from the registry is as follows:
Code:
$RegExSetup = 'Software\\Microsoft\\ExchangeServer\\v14\\Setup'
  
 $Server = (Get-Content env:ComputerName)
 $Registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $Server)
 $RegKey = $Registry.OpenSubKey($RegExSetup)
  
 $V1 = "MsiBuildMajor"
  
 $V2 = "MsiBuildMinor"
  
 $BuildMajor = ($RegKey.GetValue($V1)) –as [String]
  
 $BuildMinor = ($RegKey.GetValue($V2)) –as [String]
 $ExVersion = $BuildMajor + “.” + $BuildMinor
  
 Write-Host $Server “runs version” $ExVersion
Exchange 2010 server versions are reported in terms of a major build number and a minor build number. Exchange 2010 SP1 is major build 218 and minor build 15, so if you meet a server that reports a build number of 218.15, you know that it runs Exchange 2010 SP1.As proven in the screen shot, this code works. However, it’s probably not the most elegant code in the world, so feel free to improve it.



Interrogating the system registry to return Exchange server version data

Moving to how to extract Exchange server version data from Active Directory, you can run these commands to fetch and report the version number for a server. This is actually how Microsoft describe how to retrieve a server version in TechNet. The AdminDisplayVersion property is displayed with the Get-ExchangeServer cmdlet and in the About menu in EMC. However, you will see other versions reported elsewhere in the product. For example, the Mailbox Replication Service (MRS) faithfully reports that it runs version 218.0 in its mailbox move reports.
Code:
PS> Get-ExchangeServer -Identity ExServer1 | Format-Table Name, AdminDisplayVersion


Returning the version data for an Exchange 2010 server

To fetch build information for all servers in the organization, just omit the -Identity parameter and the name of the specific server as used in the example, which is what I do in the screen shot below. You can see that the build information is different to what’s reported from the registry in that Exchange tells you its “administrative display version” and then its major and minor build numbers. The administrative build in this instance is 14.1 for all servers, meaning that they are Exchange 2010 SP1 servers (Exchange 2010 is version 14). The difference between the reported major and minor builds is accounted for because two of the servers run the RTM version of SP1 while the other (an edge server that I haven’t gotten around to upgrading) runs an earlier build that Microsoft released during the SP1 development process.


Returning version data for all servers in the organization

I’ve also seen examples of code that use an LDAP lookup to fetch the same information:
Code:
PS> [ADSI]"LDAP://contoso.com/$(Get-ExchangeServer ExServer1| Select-Object -Expand dis*)" | Format-Table SerialNumber


Using LDAP to fetch the Exchange server version data from Active Directory

As you can see, the values reported for the serialNumber property of the server object include version 14.1, so that’s consistent, but the value of the build is 30218.15! I’m not suspicious (just paranoid), so I checked the property with ADSIEdit (below) and the same values are present. I guess that the Get-ExchangeServer cmdlet must trim the first two characters from the build number before it reports the data in AdminDisplayVersion.


Viewing server properties with ADSIEdit

All of this proves that the information is available and a range of solutions are available to extract it from a server or Active Directory – and that you can comfortably waste several hours poking around to discover information like this. Sometimes you will want to run code on a server and sometimes you’ll want to collate information from a range of servers, so it’s good to have the choice of approaches.

Comments

Popular posts from this blog

Calculate how much data can be transferred in 24 hours based on link speed in data center

  In case you are planning for migration via DIA or IPVPN link and as example you have 200Mb stable speed so you could calculate using the below formula. (( 200Mb /8)x60x60x24) /1024/1024 = 2TB /per day In case you have different speed you could replace the 200Mb by any rate to calculate as example below. (( 5 00Mb /8)x60x60x24) /1024/1024 =  5.15TB  /per day So approximate each 100Mb would allow around 1TB per day.

Recreating a VMFS-3 or VMFS-5 partition table in ESXi 5.x

For this kind of issues you need to engage VMware support on this, following any part of this article could lead to more complex situation if not ran by an expert.   Symptoms Datastore does not mount because of a lost or overwritten partition table.   Purpose When a VMFS partition is created in ESX 3.x or ESX 4.x, it has a Master Boot Record (MBR) partition map. The MBR is written to the first 512 B block (LBA0) and contains the information where the (VMFS) partition starts and ends. ESXi 5.0 introduced VMFS-5, which uses a GUID partition table (GPT) for new datastores. When a VMFS-3 partition is created in ESXi 5.x and is later updated to VMFS-5, the original partition map (MBR) is maintained. If the partition information of a VMFS datastore is deleted or overwritten (for example, by a Windows system with direct access to the same disks), it is impossible to determine if the partition map was GPT or MBR. The only time you can be sure that a GPT partition map was used is if th...

How to deploy an OVA in Cloud Director

  How to deploy an OVA in Cloud Director Yesterday I was in a call with a customer and we discussed uploading OVA’s into Cloud Director. I said sure that is no problem at all. Well then I started thinking how are you supposed to deploy an OVA in Cloud Director because I do not even remember how this is done. So I opened up Cloud Director and tried it for myself. I decided to make this blog post along the way to show you how to deploy an OVA in Cloud Director. As an added bonus I will also show you how to upload an OVA to the catalog. This way I can deploy the OVA over and over again. Environment information Cloud director 10.3 OVA How to deploy an OVA in Cloud Director In Cloud director I opened up the Applications section and selected “NEW” I am deploying an OVA so I selected “Add vApp From OVF”. In the screenshot below you can see all the steps involved with (in my case) deploying and customising the Usagemeter. Options to customise are for instance: Network settings, vApp naming...