AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 717269
Accepted
makerofthings7
makerofthings7
Asked: 2015-08-28 07:12:52 +0800 CST2015-08-28 07:12:52 +0800 CST 2015-08-28 07:12:52 +0800 CST

我应该如何测试我的所有 300 个 AcceptedDomain 是否存在自动发现问题?

  • 772

我注意到许多域在 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 [email protected] -To [email protected] -Subject "Invalid SSL Certificate" -SmtpServer internalsmtp.nfp.com -Body "We failed to read file $FailedItem. The error message was $ErrorMessage for domain $url"
        Break
}
}
exchange-2013
  • 1 1 个回答
  • 43 Views

1 个回答

  • Voted
  1. Best Answer
    makerofthings7
    2015-08-30T14:08:27+08:002015-08-30T14:08:27+08:00

    这是我想出的脚本。我仍然需要一种方法来轻松获取所有活动的主 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 [email protected] -To [email protected] -Subject "Invalid SSL Certificate Report" -SmtpServer internalsmtp.company.com -Body $sb.tostring()
    
    • 1

相关问题

  • 在 Exchange 2013 中为 Outlook Web App (OWA) 创建自定义用户主题

  • IMAP 到 Exchange 2013 迁移:powershell cmdlet 无法识别 -IMAP

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve