Scenario: You want a report that will email you the Engine Update Information for all of your Exchange 2013 Servers that are using the native Malware Protection.
Script:
#Create Variables $ExchangeServers = Get-ExchangeServer | Where AdminDisplayVersion -like "Version 15*" $final = @() $strCurrentTimeZone = (Get-WmiObject win32_timezone).StandardName $TZ = [System.TimeZoneInfo]::FindSystemTimeZoneById($strCurrentTimeZone) #Check for Malware Engine Updates. Loop and Invoke Commands. $Exchangeservers | %{ $server = $_.name $LC = Invoke-Command –Computername $_ -ScriptBlock {Add-PSSnapin microsoft.forefront.filtering.management.powershell;(Get-EngineUpdateInformation).LastChecked } -ErrorAction STOP $LU = Invoke-Command –Computername $_ -ScriptBlock {Add-PSSnapin microsoft.forefront.filtering.management.powershell;(Get-EngineUpdateInformation).LastUpdated } -ErrorAction STOP $EV = Invoke-Command –Computername $_ -ScriptBlock {Add-PSSnapin microsoft.forefront.filtering.management.powershell;(Get-EngineUpdateInformation).EngineVersion } -ErrorAction STOP #Convert from UTC to Local Time Zone. $LCLocal = [System.TimeZoneInfo]::ConvertTimeFromUtc($LC, $TZ) $LULocal = [System.TimeZoneInfo]::ConvertTimeFromUtc($LU, $TZ) #Build the Array $ServerObj = New-Object PSObject $ServerObj | Add-Member NoteProperty -Name "ServerName" -Value $server $ServerObj | Add-Member NoteProperty -Name "LastChecked" -Value $LCLocal $ServerObj | Add-Member NoteProperty -Name "LastUpdated" -value $LULocal $ServerObj | Add-Member NoteProperty -Name "EngineVersion" -value $EV $Final += $ServerObj } $EngineUpdates = $final | Sort ServerName | Convertto-HTML #Email $body ="" $smtp = "mail.domain.com" $to = "steve@domain.com" $from = "EngineUpdateMonitor@domain.com" $subject = "Engine Update Monitor" $body += "<b><Font color=#0404B4>Malware Engine Updates: </b></font><br><br>" $body += "$EngineUpdates <br><br><br>" send-MailMessage -SmtpServer $smtp -To $to -From $from -Subject $subject -Body $body -BodyAsHtml -Priority high