
#BugSnag
try {
    Write-host "Verifying Error Reporting" -ForegroundColor Yellow
    $response = Invoke-WebRequest -Method 'POST' -Uri 'https://notify.bugsnag.com/ping' -SkipCertificateCheck
    if ($response.Content.trim() -eq 'pong') {
        Write-Host "Bug Reporting: OK" -ForegroundColor Green
    } else {
        Write-Host "Did not get a correct response from BugSnag. Do you have a restrictive outgoing Firewall? Check this with IT" -ForegroundColor Red
    }
    
} catch [System.Net.WebException] {
    $exceptionMessage = $Error[0].Exception
    if ($exceptionMessage -match "405") {
        Write-Host "OK" -ForegroundColor Green
    }
    else {
        Write-Host "Ask IT to allow outbound connections to 104.196.245.109 & 104.196.254.247" -ForegroundColor Red
    }
}
