AdminDisplayVersion as a structure
Neil posted this morning about how to find your Exchange 2007 server's "installed bits" version using powershell and the "AdminDisplayVersion" property. Great post, and a simple way to determine -- particularly in bulk for many servers -- what version of Exchange 2007 you're running.
Now, what's interesting is that if you just do "Get-ExchangeServer | fl name,AdminDisplayVersion", it'll return AdminDisplayVersion as a pretty string -- for instance something like the RTM string: "Version 8.0 (Build 685.24)". The intent of this pretty string is to provide the information that's displayed in the Exchange Management Console GUI column so you can filter on it or sort based on it. It's also useful because you'll see when SP1 comes out that the string will visually embed information that it's a service pack and which one.
So, what if you want to do some more complex comparison between servers (which one has higher version, how many at version 8.0 vs 8.1)... the sort of information that might require you to "parse" out the string into the major, minor, build parts of the version?
Good news! Although its default output is a pretty string, underneath it's actually a structured property on the ExchangeServer output object. So this means you can get all of the component parts of the version without having to do any parsing. Here's an example:
[PS] C:\>(Get-ExchangeServer).AdminDisplayVersion
Major : 8
Minor : 0
Build : 685
Revision : 24
FilePatchLevelDescription :