Exchange-2013
我應該如何測試我的所有 300 個 AcceptedDomain 是否存在自動發現問題?
我注意到許多域在 Exchange 2013 上都失敗了,因為他們網站上的萬用字元證書無效。
我如何(至少)掃描和測試這種類型的故障?
下面是我腳本的開頭,但在 Powershell 中真的很生疏。有沒有人認為這是一個有效的解決方案,或者有更好的解決方案?
$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 } }
這是我想出的腳本。我仍然需要一種方法來輕鬆獲取所有活動的主 SMTP 地址,但這是一個開始。
#This script tests the naked domain and autodiscover record for issues. #often times a wildcard cert will cause a name mismatch, or the cert is invalid, expired, or revoked $ErrorActionPreference = "Stop"; #todo, don't use accepted domains, only use the addresses listed as a primary on # a user, because that is the only domain that counts for Autodiscover. $domains = "a.com”, “b.com”, “b.com" $errors = @{} foreach ($d2 in $domains) { Try { $url = "https://$d2" $url $wc = New-Object System.Net.WebClient $wc.DownloadString($url) } Catch { $ErrorMessage = $_.Exception.Message $FailedItem = $_.Exception.ItemName $errors.Add($url, $_.Exception.Message) } Try { $url = "https://autodiscover.$d2" $url $wc = New-Object System.Net.WebClient $wc.DownloadString($url) } Catch { $ErrorMessage = $_.Exception.Message $FailedItem = $_.Exception.ItemName $errors.Add($url, $errormessage) } } $sb = New-Object -TypeName "System.Text.StringBuilder"; foreach ($e in $errors.keys) { $e2 = $errors.$e #The remote name could not be resolved #Could not establish trust relationship $sb.AppendLine("$e had error @ $e2 " ); } Send-MailMessage -From ExchangeAutodiscover@company.com -To chris@company.Com -Subject "Invalid SSL Certificate Report" -SmtpServer internalsmtp.company.com -Body $sb.tostring()