I noticed that many domains are failing on Exchange 2013 because of an invalid wildcard certificate on their website.
How can I (at a minimum) scan and test for this type of failure?
Below is the beginning of my script, but am really rusty in Powershell. Does anyone think this is a valid solution, or have a better one?
$ErrorActionPreference = "Stop";
$domains = get-accepteddomain
foreach ($d in $domains)
{
Try
{
$url = "https://$d"
$wc = New-Object System.Net.WebClient
$wc.DownloadString($url)
}
Catch
{
$ErrorMessage = $_.Exception.Message
$FailedItem = $_.Exception.ItemName
Send-MailMessage -From ExchangeAutodiscover@company.com -To chris@company.Com -Subject "Invalid SSL Certificate" -SmtpServer internalsmtp.nfp.com -Body "We failed to read file $FailedItem. The error message was $ErrorMessage for domain $url"
Break
}
}