Sunday, August 30, 2015

[EX2010] Collect Exchange version of all servers



$installpath = "c$\Program Files\Microsoft\Exchange Server\V14\Bin\ExSetup.exe"
Get-ExchangeServer  | ?{$_.admindisplayversion -like  "*14*"} | %{
$Servername = $_.Name
$role = $_.serverrole
$Path = "\\" + $Servername + "\" + $installpath
$fileversion = (Get-Command $Path).FileVersionInfo |ForEach {$_.FileVersion}
$result = $Servername + "|" +  $fileversion + "|" + $role
$result
$result >> result.txt
}