Write-Verbose "Test-ExchangeMitigation: Start" Write-Verbose "Test-ExchangeMitigation: Check URLSCan" $error.clear() $urlscaninstalled = Get-Item "HKLM:\SOFTWARE\Microsoft\IIS Extensions\URL Rewrite\" -ErrorAction SilentlyContinue if (!$?) { "ERROR:URLRewrite Detection Failed" } elseif ($null -eq $urlscaninstalled) { "FAIL:IIS URLRewrite Not Installed" } elseif ($urlscaninstalled.getvalue("Install") -ne 1){ "FAIL:IIS URLRewrite Not Installed" } Else { "OK:IIS URLRewriteInstalled" } Write-Verbose "Test-ExchangeMitigation: Check Mitigation Service" $error.clear() $mitigationservice = (Get-Service MSExchangeMitigation -ErrorAction SilentlyContinue) if (!$?) { "ERROR:Unable to geht Mitigation Service. not installed or no permission" } elseif ($mitigationservice.running -eq $true) { "FAIL:Mitigation Service not Running" } else{ "OK:Mitigation Service Running" } Write-Verbose "Test-ExchangeMitigation: Check Service Running" $error.clear() $mitigationprocess = Get-Process "Microsoft.Exchange.Mitigation.Service" -errorAction Silentlycontinue if (!$?) { "FAIL:Unable to get Mitigation Process in Tasklist - not running or no permission" } else { "OK: Microsoft.Exchange.Mitigation.Service running" } #Write-Verbose "Test-ExchangeMitigation: Check Eventlog last 5 Min " #$error.clear() #$mitigationlog = (Get-EventLog -LogName Application -Source "MSExchange Mitigation Service") Write-Verbose "Test-ExchangeMitigation: Check Internet Access" $error.clear() [xml]$mitigationxml = (Invoke-RestMethod https://officeclient.microsoft.com/getexchangemitigations) if (!$?) { "ERROR: Unable to retrieve mitigations from microsoft. Check Internet access $($error)" } else { [long]$mitigationcount = $mitigationxml.EOCS.config.count if (!$?) { "ERROR: Unable to convert XML to uint mitigationcount" } else { "OK: Mitigation Count $($mitigationcount)" } } Write-Verbose "Test-ExchangeMitigation: ExchangeServerstatus" $error.clear() # # Dieser Test funktioniert nur mit Exchange PowerShell #(Get-ExchangeServer).MitigationsEnabled #True #$MitigationsApplied = (Get-ExchangeServer).MitigationsApplied.count #1 # #if ($mitigationcount -ne $MitigationsApplied){ # "FAIL:Mitigationcount not match" #} #else { # "OK:Mitigationcount Match #} Write-Verbose "END Test-ExchangeMitigation"