Scenario: You have just updated your Exchange Servers (or Windows Servers) and you want to verify the successful install of the patches through logic.
Solution: SCRIPTLETS:
#Pull a list of Servers
$Servers = get-exchangeserver |sort name| Select -ExpandProperty Name
#-or-
$servers = "ExServer1","ExServer2"
#Pull Updates
$Ex_Updates = @(); $servers | %{$n = $_; "Checking Exchange File for $n"; $Ex_Updates+= Invoke-Command -ComputerName $n -ScriptBlock {GCM exsetup |%{$_.Fileversioninfo}}}
$Win_Updates = @(); $servers | %{$n = $_; "Checking Windows Updates for $n"; $Win_Updates+= Get-HotFix -ComputerName $n |Where InstalledOn -ge (get-date).AddDays(-7) | Select @{Name="Server";Expression={$n}}, Description, HotFixID, InstalledOn }
#Display variables of updates
$Ex_updates
$Win_Updates
#Note: You can group to make it easier to quickly identify everything looks right
$Win_Updates |Group Hotfixid
$Win_Updates |Group server