启用并使用Microsoft Defender for Endpoint中的故障排除模式

在 Windows 设备上,Microsoft Defender for Endpoint 的故障排除模式允许你临时更改某些策略管理的 Microsoft Defender 杀毒软件设置。 使用故障排除模式来诊断性能、应用兼容性、误报及其他杀毒问题,包括当防 篡改 防止更改 受保护设置时。

故障排查模式适用于运行Windows或macOS的Defender for Endpoint设备。 目前,Linux 设备无法使用故障排查模式。 在 macOS 上,故障排除模式下无法关闭篡改防护。 关于macOS的需求和说明,请参见macOS上的Microsoft Defender for Endpoint中的故障排除模式。

在故障排查模式激活期间,本地管理员可以更改通常被策略锁定的单个设备的设置。 本地管理员无法关闭或卸载 Microsoft Defender 杀毒软件,但可以更改其他 Microsoft Defender 杀毒软件的安全设置,如云保护和防篡改保护。

故障排除模式启动可能需要长达15分钟,且在四小时后自动关闭。 每台设备限制为8小时,且配额在首次启用故障排除模式后24小时重置。 故障排除模式到期后,策略管理的设置变成只读并恢复到之前的值。 设备用户会在故障排除模式开始、即将结束和结束时收到通知。

暂时禁用防篡改保护可能会增加安全风险。 当你暂时关闭防篡改保护时,设备必须处于在线状态。

在故障排除模式激活期间,通过管理策略实施的变更在故障排除模式到期前不会生效。 在故障排查模式激活时,Microsoft Defender杀毒平台更新也不会被应用。 在故障排除模式结束后,Windows 更新运行时会应用平台更新。

Prerequisites

在启用故障排查模式之前,请确认以下要求:

  • Microsoft Entra 的安全管理员角色。 对于最小权限访问,使用自定义的 Microsoft Defender 统一基于角色的访问控制(RBAC)角色,包含授权与设置 \ 安全设置 \ 核心安全设置(管理)和授权设置 \ 安全设置 \ 检测调优(管理)权限。 有关详细信息,请参阅 Microsoft Defender 统一 RBAC。
  • 一个已注册并活跃于 Defender for Endpoint 的设备。
  • Microsoft Defender 防病毒平台版本 4.18.2203(2022 年 3 月)或更高版本,且正在设备上主动运行。
  • 以下操作系统之一及其最小版本或构建:
    • Windows 10:

      • 21H2(2021 年 11 月):内部版本 19044.1618(2022 年 3 月)或更高版本。
      • 21H1(2021年5月):建造 19043.1620 (2022年3月)或更晚。
      • 20H2(2020年10月):版本 19042.1620(2022年3月)或更高版本。
      • 20H1(2020 年 5 月):内部版本 19041.1620(2022 年 3 月)或更高版本。

      有关更新,请参见KB5011543:Microsoft更新目录。

    • Windows 11:支持的版本。

    • Windows Server 2019:内部版本 17763.2746(2022 年 3 月)或更高版本。 有关更新,请参见KB5011551:Microsoft更新目录。

    • Windows Server 2022:内部版本 20348.617(2022 年 3 月)或更高版本。 有关更新,请参见KB5011558:Microsoft更新目录。

    • 后续的 Windows Server 版本。

    • Azure Stack HCI:版本23H2(2023年11月)或更晚。

    • Windows Server 2012 R2 或 Windows Server 2016:现代统一解决方案,包含以下所有最低组件版本:

在 Microsoft Defender 门户中启用故障排除模式

在临时更改Microsoft Defender杀毒设置前,请启用设备故障排查模式:

  1. 在 Microsoft Defender 门户https://security.microsoft.com/machines的设备库存页面,选择设备行中除复选框外的任意位置。

  2. 在设备详情页面,选择 更多选项 (...),然后选择 “开启故障排查模式”。

    设备操作菜单截图,选中了“开启故障排查模式”。

    Note

    所有设备都会出现“ 开启故障排查模式 ”选项,即使设备不符合前提条件。

  3. 在确认弹窗中,选择 提交。

    开启故障排除模式确认窗口的截图。

  4. 等设备详情页面显示故障排查模式已激活。 激活时间最长可达15分钟。

暂时禁用防篡改保护

故障排除模式激活后,请在支持的 Windows 设备上使用 PowerShell,或在支持的 Windows 客户端设备上使用 Windows 安全中心 应用,暂时禁用防篡改保护。

暂时禁用PowerShell的防篡改功能

要在设备处于故障排查模式时暂时禁用篡改保护,请在提升权限的 PowerShell 会话中运行以下 Set-MpPreference 命令(即通过选择 以管理员身份运行 打开的 PowerShell 窗口):

Set-MPPreference -DisableTamperProtection $true

要验证设备上的防篡改状态,请执行以下命令:

Get-MpComputerStatus | Select-Object IsTamperProtected

数值 False 显示防篡改保护是关闭的。

使用Windows 安全中心应用暂时禁用防篡改功能

请按照“使用Windows 安全中心应用配置防篡改保护”中的步骤关闭防篡改保护。

Note

你不需要手动重新开启防篡改保护。 当故障排除模式到期时,临时更改被丢弃,篡改保护恢复到之前的策略管理状态。 如果之前开启了防篡改保护,它会重新开启。 如果之前关闭,则保持关闭状态。

请查看故障排查模式的结果

Defender for Endpoint 在整个故障排除过程中收集日志和调查数据:

  • 在故障排除模式开始之前,会创建 MpPreference 的快照。
  • 在故障排除模式即将到期前,会创建第二个快照。
  • 操作日志在故障排查模式激活时收集。

请使用以下方法来审查或收集故障排除模式的信息:

  • Microsoft Defender 门户:在设备页面的设备时间线中查看故障排除模式的开始时间和结束时间。
  • 事件查看器:展开应用与服务日志>Microsoft Windows>>Windows Defender,然后选择运营中。 事件可能包括事件ID 5000、5001、5004和5007。 有关详细信息,请参阅查看事件日志和错误代码以排查Microsoft Defender防病毒问题。
  • 调查包:在设备页面使用 “收集调查包 ”来收集日志和快照。 数据会一直留在设备上,直到管理员收集。
  • 高级狩猎:使用 高级搜寻查询 来审查故障排除模式事件。

高级搜寻查询

请使用以下高级搜寻查询,查看您的环境中的故障排除模式事件。 你还可以利用这些查询 创建检测规则 ,在设备处于故障排除模式时生成警报。

获取特定设备的故障排除事件

通过 deviceId 或 deviceName 搜索,方法是将你不想使用的那一行注释掉。

//let deviceName = "<deviceName>";   // update with device name
let deviceId = "<deviceID>";   // update with device id
DeviceEvents
| where DeviceId == deviceId
//| where DeviceName  == deviceName
| where ActionType == "AntivirusTroubleshootModeEvent"
| extend _tsmodeproperties = parse_json(AdditionalFields)
| project Timestamp,DeviceId, DeviceName, _tsmodeproperties,
 _tsmodeproperties.TroubleshootingState, _tsmodeproperties.TroubleshootingPreviousState, _tsmodeproperties.TroubleshootingStartTime,
 _tsmodeproperties.TroubleshootingStateExpiry, _tsmodeproperties.TroubleshootingStateRemainingMinutes,
 _tsmodeproperties.TroubleshootingStateChangeReason, _tsmodeproperties.TroubleshootingStateChangeSource

当前处于故障排除模式的设备

DeviceEvents
| where Timestamp > ago(3h) // troubleshooting mode automatically disables after 4 hours
| where ActionType == "AntivirusTroubleshootModeEvent"
| extend _tsmodeproperties = parse_json(AdditionalFields)
| where _tsmodeproperties.TroubleshootingStateChangeReason contains "started"
|summarize (Timestamp, ReportId)=arg_max(Timestamp, ReportId), count() by DeviceId
| order by Timestamp desc

按设备统计的故障排除模式实例计数

DeviceEvents
| where ActionType == "AntivirusTroubleshootModeEvent"
| extend _tsmodeproperties = parse_json(AdditionalFields)
| where Timestamp > ago(30d)  // choose the date range you want
| where _tsmodeproperties.TroubleshootingStateChangeReason contains "started"
| summarize (Timestamp, ReportId)=arg_max(Timestamp, ReportId), count() by DeviceId
| sort by count_

在某个时间范围内统计故障排查模式实例

DeviceEvents
| where ActionType == "AntivirusTroubleshootModeEvent"
| extend _tsmodeproperties = parse_json(AdditionalFields)
| where Timestamp > ago(2d) //beginning of time range
| where Timestamp < ago(1d) //end of time range
| where _tsmodeproperties.TroubleshootingStateChangeReason contains "started"
| summarize (Timestamp, ReportId)=arg_max(Timestamp, ReportId), count()
| where count_ > 5          // choose your max # of TS mode instances for your time range