当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] Dcdiag:如何检查域控制器运行状况

作者:精品下载站 日期:2024-12-14 17:34:50 浏览:13 分类:玩电脑

Dcdiag:如何检查域控制器运行状况


在本教程中,我将向您展示如何使用 Dcdiag 命令行实用程序来执行域控制器运行状况检查和测试 DNS。

我还将向您展示一个 GUI 工具,可让您同时检查多个域控制器的运行状况。

请务必检查下面的示例部分,我将向您展示正常域控制器和有问题的域控制器的输出。

目录:

  • 什么是 Dcdiag
  • 如何安装 Dcdiag
  • 使用 Dcdiag 检查 Active Directory 运行状况
  • 自动化 AD 健康检查(电子邮件报告)
  • Active Directory 诊断测试

让我们开始吧。

什么是 Dcdiag

Dcdiag 是一个 Microsoft Windows 命令行实用程序,可以分析林或企业中域控制器的状态。您可以选择分析单个域控制器或林中的所有 DC。

您可能会想,命令行实用程序在测试和查找域控制器问题方面到底有多好?

嗯,它实际上做得非常好!我很惊讶地发现这个命令实际上做了多少不同的测试。

我算了一下,一共有30个不同的测试,有些测试还有多个测试。

那么 Dcdiag 实际上是做什么的呢?它执行哪些类型的测试?

您可以在命令帮助菜单中查看测试列表,运行 dcdiag /?查看帮助菜单。

我不得不承认帮助命令中的描述并没有那么有帮助。我看到 Ned Pyle 写的一篇很好的博客文章,名为 DCDiag 实际上做了什么,它更详细地解释了每个测试。如果您有兴趣确切了解 Dcdiag 命令的作用,那么我建议您阅读该文章。

如何安装 Dcdiag

如果要运行 Dcdiag 或使用 Active Directory 运行状况检查工具,则需要安装 RSAT 工具。

您很有可能已经安装了 Dcdiag 工具。

如果您安装了 AD DS 角色,则 Dcdiag 已安装。

如果您安装了远程服务器管理工具 (RSAT) 工具,则您已经安装了 Dcdiag。

使用 Dcdiag 检查 Active Directory 运行状况(示例)

DCDiag 非常易于使用。

有几种不同的命令行开关可以与 Dcdiag 一起使用,要查看它们,只需使用此命令 dcdiag /?

以下是我将在下面的示例中使用的开关的概述。

/s:dcname 开关用于针对远程服务器运行 Dcdiag

/v:开关打印有关每个测试的更详细信息

/c:开关意味着全面,这将运行所有测试,包括 dns 测试。

/q:开关将只打印错误。这很有用,因为 dcdiag 可以显示大量信息,如果您只想查看错误,请使用此开关。

/f:开关用于将结果重定向到文件。

提示:运行 dcdiag 时,它可能会报告一些错误,但这并不一定意味着您的域控制器存在问题。例如,该命令将查询 DC 上的系统日志并显示错误日志,但它们可能是来自计算机或其他服务器的错误。同样,这可能不是 DC 问题。您只需检查并确定它是否相关。

视频教程

如果您不喜欢视频教程或想要更多详细信息,请继续阅读下面的说明。

示例 1:使用 /s 针对远程服务器运行

这将针对远程服务器 DC1 运行所有 DC 测试。

dcdiag /s:DC1

要在本地服务器上运行它,只需省略 /s:servername

示例 2:使用 /v 显示更多详细信息

详细开关将显示更多详细信息。它执行与第一个示例相同的测试,只是显示有关每个测试的更多详细信息。

dcdiag /s:DC1 /v

示例 3:使用 /f 保存到日志文件

通过使用 /f 您可以将结果保存到文本文件中。这对于记录结果并在以后查看它们非常有用。

dcdiag /s:DC1 /f:c:\it\dcdiag_test.txt

示例 4:使用 /a 针对所有域控制器运行

如果您有多个域控制器并希望一次测试所有域控制器,请使用此命令。如果您有许多域控制器,则会显示大量信息,这就是使用 /f 选项派上用场的地方。

dcdiag /s:DC1 /a

示例 5:使用 /q 仅显示错误

DCDiag 可以显示很多信息,要去除噪音并仅显示错误,请使用此命令。

dcdiag /s:DC1 /q

示例 6:使用多个开关(我最喜欢)

这是我喜欢运行的命令。它将运行所有测试,显示所有详细信息,并将其输出到文件中。

dcdiag /s:DC1 /c /v /f:c:\it\dcdiag_test.txt

现在您已经知道如何测试域控制器了,我将继续测试 DNS。顺便说一句,如果您使用包含 /c 的最后一个示例,则该开关将运行包括 DNS 在内的所有测试。

如何使用 DCDiag 测试 DNS

DNS 诊断还包括多项测试。

以下是执行的测试,默认情况下运行除外部名称解析之外的所有测试。

/DnsBasic(基本测试,不可跳过)
/DnsForwarders(转发器和根提示测试)
/DnsDelegation(委托测试)
/DnsDynamicUpdate(动态更新测试)
/DnsRecordRegistration(记录注册测试)
/DnsResolveExtName(外部名称解析测试)
/DnsAll(包括上述所有测试)
/DnsInternetName: (用于测试 /DnsResolveExtName)

使用以下命令运行 DNS 测试

dcdiag /s:dc1 /test:dns

示例:来自普通域控制器的 Dcdiag 结果

Directory Server Diagnosis
Performing initial setup:
* Identified AD Forest.
Done gathering initial info.

Doing initial required tests

Testing server: Default-First-Site-Name\DC1
Starting test: Connectivity
......................... DC1 passed test Connectivity

Doing primary tests

Testing server: Default-First-Site-Name\DC1
Starting test: Advertising
......................... DC1 passed test Advertising
Starting test: FrsEvent
......................... DC1 passed test FrsEvent
Starting test: DFSREvent
......................... DC1 passed test DFSREvent
Starting test: SysVolCheck
......................... DC1 passed test SysVolCheck
Starting test: KccEvent
......................... DC1 passed test KccEvent
Starting test: KnowsOfRoleHolders
......................... DC1 passed test KnowsOfRoleHolders
Starting test: MachineAccount
......................... DC1 passed test MachineAccount
Starting test: NCSecDesc
......................... DC1 passed test NCSecDesc
Starting test: NetLogons
......................... DC1 passed test NetLogons
Starting test: ObjectsReplicated
......................... DC1 passed test ObjectsReplicated
Starting test: Replications
......................... DC1 passed test Replications
Starting test: RidManager
......................... DC1 passed test RidManager
Starting test: Services
......................... DC1 passed test Services
Starting test: SystemLog ......................... DC1 passed test SystemLog Starting test: VerifyReferences
......................... DC1 passed test VerifyReferences

Running partition tests on : ForestDnsZones
Starting test: CheckSDRefDom
......................... ForestDnsZones passed test CheckSDRefDom
Starting test: CrossRefValidation
......................... ForestDnsZones passed test CrossRefValidation

Running partition tests on : DomainDnsZones
Starting test: CheckSDRefDom
......................... DomainDnsZones passed test CheckSDRefDom
Starting test: CrossRefValidation
......................... DomainDnsZones passed test CrossRefValidation

Running partition tests on : Schema
Starting test: CheckSDRefDom
......................... Schema passed test CheckSDRefDom
Starting test: CrossRefValidation
......................... Schema passed test CrossRefValidation

Running partition tests on : Configuration
Starting test: CheckSDRefDom
......................... Configuration passed test CheckSDRefDom
Starting test: CrossRefValidation
......................... Configuration passed test CrossRefValidation

Running partition tests on : ad
Starting test: CheckSDRefDom
......................... ad passed test CheckSDRefDom
Starting test: CrossRefValidation
......................... ad passed test CrossRefValidation

Running enterprise tests on : ad.activedirectorypro.com
Starting test: LocatorCheck
......................... ad.activedirectorypro.com passed test LocatorCheck
Starting test: Intersite
......................... ad.activedirectorypro.com passed test Intersite

示例:kdc 服务和 NETLOGON 服务失败

以下是 kdc 和 NETLOGON 服务停止时的 dcdiag 输出。我使用 /q 开关仅显示错误

C:\Users\rallen>dcdiag /s:dc2 /q
 Fatal Error:DsGetDcName (DC2) call failed, error 1717
 The Locator could not find the server.
 ......................... DC2 failed test Advertising
 kdc Service is stopped on [DC2]
 NETLOGON Service is stopped on [DC2]
 ......................... DC2 failed test Services
 Warning: DcGetDcName(GC_SERVER_REQUIRED) call failed, error 1717
 A Global Catalog Server could not be located - All GC's are down.
 Warning: DcGetDcName(PDC_REQUIRED) call failed, error 1717
 A Primary Domain Controller could not be located.
 The server holding the PDC role is down.
 Warning: DcGetDcName(TIME_SERVER) call failed, error 1717
 A Time Server could not be located.
 The server holding the PDC role is down.
 Warning: DcGetDcName(GOOD_TIME_SERVER_PREFERRED) call failed, error 1717
 A Good Time Server could not be located.
 Warning: DcGetDcName(KDC_REQUIRED) call failed, error 1717
 A KDC could not be located - All the KDCs are down.
 ......................... ad.activedirectorypro.com failed test LocatorCheck

就是这样。

容易吧?

DCDiag 是一个简单但非常强大的工具,用于检查和诊断域控制器。我强烈建议您熟悉这个工具并时常在您的环境中运行它。

使用 AD Pro Toolkit 检查 Active Directory 运行状况

Active Directory 运行状况检查工具可在域控制器上创建易于阅读的运行状况报告。 l 可以非常轻松地同时检查多个域控制器的运行状况。

GUI 工具具有以下优点:

  • 轻松检查多个域控制器上的 Active Directory 运行状况
  • 通过单击测试快速查看测试失败的原因
  • 从 Windows 事件日志中获取重要事件(错误、警告、严重错误)
  • 导出和安排自动报告

[玩转系统] Dcdiag:如何检查域控制器运行状况

该工具还可以从域控制器获取关键事件。这样可以轻松查看日志并快速发现潜在问题。

[玩转系统] Dcdiag:如何检查域控制器运行状况

您可以通过单击下面的按钮下载此 GUI 运行状况监控工具的免费试用版。

自动化 AD 健康检查(电子邮件报告)

使用内置调度程序自动检查域控制器的运行状况。安排报告每天、每周或每月运行一次(我建议每天运行)。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯