使用 Powershell 评估Microsoft Defender防病毒

适用于:

在Windows 10或更高版本以及Windows Server 2016或更高版本中,可以使用Microsoft Defender防病毒 (MDAV) 和Microsoft Defender攻击防护 (Microsoft Defender EG) 提供的下一代保护功能。

本主题介绍如何在 Microsoft Defender AV 和 Microsoft Defender EG 中启用和测试密钥保护功能,并提供指导和详细信息链接。

建议 使用此评估 PowerShell 脚本 来配置这些功能,但可以使用本文档其余部分所述的 cmdlet 单独启用每个功能。

有关 EPP 产品的详细信息,请参阅以下产品文档库:

本文介绍Windows 10或更高版本以及Windows Server 2016或更高版本中的配置选项。

如果你对 AV 进行Microsoft Defender检测有任何疑问,或者发现错过了检测,可以在我们的示例提交帮助网站向我们提交文件。

使用 PowerShell 启用功能

本指南提供Microsoft Defender防病毒 cmdlet,这些 cmdlet 配置应用于评估保护的功能。

若要使用这些 cmdlet,请执行以下步骤:

1. 打开提升的 PowerShell 实例 (选择以管理员身份运行) 。

2. 输入本指南中列出的命令,然后按 Enter。

可以使用 Get-MpPreference PowerShell cmdlet 在开始之前或在评估期间检查所有设置的状态。

Microsoft Defender AV 指示通过标准 Windows 通知进行检测。 还可以在 Microsoft Defender AV 应用中查看检测

Windows 事件日志还记录检测和引擎事件。 有关事件 ID 及其相应操作的列表,请参阅Microsoft Defender防病毒事件一文

云保护功能

标准定义更新可能需要数小时才能准备和交付;云提供的保护服务可以在数秒内提供此保护。

有关更多详细信息,请参阅通过云提供的保护在 Microsoft Defender 防病毒中使用下一代技术

说明 PowerShell 命令
启用 Microsoft Defender 云以实现近乎即时的保护并增强保护 Set-MpPreference -MAPSReporting Advanced
自动提交示例以增强组保护 Set-MpPreference -SubmitSamplesConsent Always
始终使用云在数秒内阻止新的恶意软件 Set-MpPreference -DisableBlockAtFirstSeen 0
扫描所有下载的文件和附件 Set-MpPreference -DisableIOAVProtection 0
将云块级别设置为“高” Set-MpPreference -CloudBlockLevel High
将云块超时设置为 1 分钟 Set-MpPreference -CloudExtendedTimeout 50

实时扫描) (始终启用保护

Microsoft Defender AV 会在 Windows 看到文件后立即扫描这些文件,并监视正在运行的进程是否存在已知或可疑的恶意行为。 如果防病毒引擎发现恶意修改,它会立即阻止进程或文件运行。

有关这些选项的更多详细信息 ,请参阅配置行为、启发式和实时保护

说明 PowerShell 命令
持续监视文件和进程,了解已知的恶意软件修改 Set-MpPreference -DisableRealtimeMonitoring 0
持续监视已知的恶意软件行为 - 即使在“干净”文件和正在运行的程序中 Set-MpPreference -DisableBehaviorMonitoring 0
看到或运行脚本后立即对其进行扫描 Set-MpPreference -DisableScriptScanning 0
插入或装载可移动驱动器后立即对其进行扫描 Set-MpPreference -DisableRemovableDriveScanning 0

可能不需要的应用程序保护

可能不需要的应用程序 是传统上未分类为恶意的文件和应用。 其中包括常见软件的第三方安装程序、广告注入和浏览器中某些类型的工具栏。

说明 PowerShell 命令
阻止灰色软件、广告软件和其他可能不需要的应用安装 Set-MpPreference -PUAProtection 已启用

Email和存档扫描

你可以将 Microsoft Defender 防病毒设置为自动扫描某些类型的电子邮件文件和存档文件 (,例如 windows 看到 .zip 文件) 。 有关此功能的详细信息,请参阅管理Microsoft Defender中的电子邮件扫描一文。

说明 PowerShell 命令
扫描电子邮件文件和存档 Set-MpPreference -DisableArchiveScanning 0
Set-MpPreference -DisableEmailScanning 0

管理产品和保护更新

通常,你每天从 Windows 更新接收一次Microsoft Defender AV 更新。 但是,可以通过设置以下选项,并确保在 System Center Configuration Manager、组策略 或 Intune 中管理更新,从而增加这些更新的频率。

说明 PowerShell 命令
每天更新签名 Set-MpPreference -SignatureUpdateInterval
在运行计划扫描之前检查以更新签名 Set-MpPreference -CheckForSignaturesBeforeRunningScan 1

高级威胁和攻击缓解和防护 受控文件夹访问

Microsoft Defender Exploit Guard 提供的功能可帮助保护设备免受已知恶意行为和易受攻击技术的攻击。

说明 PowerShell 命令
阻止恶意和可疑应用 ((如勒索软件) )对具有受控文件夹访问权限的受保护文件夹进行更改 Set-MpPreference -EnableControlledFolderAccess Enabled
使用网络保护阻止与已知错误的 IP 地址和其他网络连接的连接 Set-MpPreference -EnableNetworkProtection 已启用
使用 Exploit Protection 应用一组标准缓解措施
https://demo.wd.microsoft.com/Content/ProcessMitigation.xml Invoke-WebRequest -OutFile ProcessMitigation.xml
Set-ProcessMitigation -PolicyFilePath ProcessMitigation.xml
通过减少攻击面来阻止已知的恶意攻击途径 Add-MpPreference -AttackSurfaceReductionRules_Ids 56a863a9-875e-4185-98a7-b882c64b5ce5 -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids 7674ba 52-37eb-4a4f-a9a1-f0f9a1619a2c -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids D4F940AB-401B-4EfC-AADCAD5F3C50688A -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids 9e6c4e1f-7d60-472f-ba1a-a39ef669e4b2 -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids BE9BA2D9-53EA-4CDC-84E5- 9B1EEEE46550 -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids 01443614-CD74-433A-B99E2ECDC07BFC25 -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids 5BEB7EFE-FD9A-4556801D275E5FFC04CC -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids D3E037E1-3EB8-44C8-A 917- 57927947596D -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids 3B576869-A4EC-4529-8536- B80A7769E899 -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids 75668C1F-73B5-4CF0-BB93- 3ECF5CB7CC84 -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids 26190899-1602-4 9e8-8b27-eb1d0a1ce869 -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids e6db77e5-3df2-4cf1-b95a-636979351e5b -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids D1E49AAC-8F56-4280-B9BA993A6D77406C -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids 33ddedf1-c6e0-47cb-83 3e-de6133960387 -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids B2B3F03D-6A65-4F7B-A9C7- 1C7EF74A9BA4 -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids c0033c00-d16d-4114-a5a0-dc9b3a7d2ceb -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids a8f5898e-1dc8-49a9-9878-85004b8a61e6 -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids 92E97FA1-2EDF-4476-BDD6- 9DD0B4DDDC7B -AttackSurfaceReductionRules_Actions 已启用
Add-MpPreference -AttackSurfaceReductionRules_Ids C1DB55AB-C21A-4637-BB3FA12568109D35 -AttackSurfaceReductionRules_Actions 已启用

某些规则可能会阻止组织可接受的行为。 在这些情况下,请将规则从“已启用”更改为“审核”,以防止不需要的块。

一键式Microsoft Defender脱机扫描

Microsoft Defender脱机扫描是Windows 10或更高版本附带的专用工具,可用于将计算机启动到正常操作系统之外的专用环境。 它对于强大的恶意软件(如 rootkit)尤其有用。

有关此功能的工作原理的详细信息,请参阅Microsoft Defender脱机

说明 PowerShell 命令
确保通知允许你将电脑启动到专用恶意软件删除环境 Set-MpPreference -UILockdown 0

资源

本部分列出了许多可帮助你评估Microsoft Defender防病毒的资源。