[玩转系统] 使用 PowerShell 清除 Windows Defender 防病毒排除项
作者:精品下载站 日期:2024-12-14 18:38:26 浏览:14 分类:玩电脑
使用 PowerShell 清除 Windows Defender 防病毒排除项
我们希望删除 Windows Defender 防病毒排除项。问题是有很多排除项,当我们进入微软病毒和威胁防护设置时,需要花费很多时间来手动删除它们。这是因为您无法选择多个排除项并将其删除。删除 Windows Defender 排除的一个绝佳方法是使用 PowerShell。因此,让我们看看使用 PowerShell 清除 Windows Defender 防病毒排除项的最快方法。
Microsoft Defender 防病毒软件
Microsoft Defender Antivirus(以前称为 Windows Defender)是 Microsoft Windows 病毒和威胁防护软件。 Microsoft Defender 防病毒软件适用于 Windows 10、Windows 11 和 Windows Server 版本。它是 Windows 操作系统的默认设置。它可以在主动模式、被动模式和禁用模式下与非 Microsoft 防病毒/反恶意软件产品一起运行。
当您转到 Windows Defender 防病毒排除项时,会显示包含所有排除项的列表。不幸的是,没有全选按钮或复选框来选择排除项并将其删除。相反,每个排除项只有一个删除按钮。
准备明确的 Windows Defender 防病毒排除 PowerShell 脚本
在开始之前,您需要将文件放置在正确的位置。我们建议在(C:)驱动器上创建两个文件夹:
-
脚本
温度
下载 Clear-WindowsDefenderExcl.ps1 PowerShell 脚本并将其放置在 C:\scripts 文件夹中。该脚本会将日志导出到 C:\temp 文件夹。
确保该文件未被阻止,以防止运行脚本时出现错误。请阅读文章运行 PowerShell 脚本时出现未数字签名错误来了解更多信息。
另一种选择是将以下代码复制并粘贴到记事本中。将其命名为 Clear-WindowsDefenderExcl.ps1 并将其放置在 C:\scripts 文件夹中。
# PowerShell script to clear the ExclusionPath, ExclusionProcess, and ExclusionExtension
# associated with Windows Defender Antivirus
# Start transcript
$Logs = "C:\temp\Clear-WindowsDefenderExcl.txt"
Start-Transcript $Logs -Append -Force
# Get Windows Defender preferences
$x = Get-MpPreference
# Get exclusion path
if ($x.ExclusionPath -ne $NULL) {
Write-Host("================================================")
Write-Host("Removing the following ExclusionPath entries:")
foreach ($i in $x.ExclusionPath) {
Remove-MpPreference -ExclusionPath $i
Write-Host($i)
}
Write-Host("================================================")
Write-Host("Total ExclusionPath entries deleted:", $x.ExclusionPath.Count)
}
else {
Write-Host("No ExclusionPath entries present. Skipping...")
}
# Get exclusion process
if ($x.ExclusionProcess -ne $NULL) {
Write-Host("================================================")
Write-Host("Removing the following ExclusionProcess entries:")
foreach ($i in $x.ExclusionProcess) {
Remove-MpPreference -ExclusionProcess $i
Write-Host($i)
}
Write-Host("================================================")
Write-Host("Total ExclusionProcess entries deleted:", $x.ExclusionProcess.Count)
}
else {
Write-Host("No ExclusionProcess entries present. Skipping...")
}
# Get exclusion extension
if ($x.ExclusionExtension -ne $NULL) {
Write-Host("================================================")
Write-Host("Removing the following ExclusionExtension entries:")
foreach ($i in $x.ExclusionExtension) {
Remove-MpPreference -ExclusionExtension $i
Write-Host($i)
}
Write-Host("================================================")
Write-Host("Total ExclusionExtension entries deleted:", $x.ExclusionExtension.Count)
}
else {
Write-Host("No ExclusionExtension entries present. Skipping...")
}
# Summary
Write-Host("================================================")
Write-Host("SUMMARY")
Write-Host($x.ExclusionPath.Count, "ExclusionPath entries deleted.")
Write-Host($x.ExclusionProcess.Count, "ExclusionProcess entries deleted.")
Write-Host($x.ExclusionProcess.Count, "ExclusionExtension entries deleted.")
Write-Host(($x.ExclusionPath.Count + $x.ExclusionProcess.Count + $x.ExclusionExtension.Count), "Total entries deleted")
Write-Host("")
Write-Host("Done.")
Stop-Transcript
第 5 行:编辑转录日志路径
运行明确的 Windows Defender 防病毒排除 PowerShell 脚本
要清除 Windows Defender 防病毒排除项:
以管理员身份运行 PowerShell
更改 scripts 文件夹的路径
运行 PowerShell 脚本以删除 Windows Defender 防病毒软件中的所有排除项
-
等待 PowerShell 脚本完成
PS C:\> cd c:\scripts
PS C:\scripts> .\Clear-WindowsDefenderExcl.ps1
注意:Windows PowerShell 控制台将显示已删除的排除条目的列表以及包含总计数的摘要。此外,它还会在日志中显示输出,因为脚本已添加到 PS 脚本中。
这是运行 Clear-WindowsDefenderExcl.ps1 PowerShell 脚本后的示例。
验证 Windows Defender 防病毒排除项是否已删除
您始终可以在 C:\temp 文件夹中找到日志输出并打开 Clear-WindowsDefenderExcl.txt 文件。
验证脚本是否成功删除了 Windows Defender 防病毒软件中的所有排除项。
禁用 Windows Defender
假设您想要禁用或卸载 Windows Defender,请阅读以下文章:
永久关闭 Windows 10 中的 Windows Defender
永久关闭 Windows 11 中的 Windows Defender
-
在 Windows Server 上卸载 Windows Defender
结论
您了解了如何使用 PowerShell 清除 Windows Defender 防病毒排除项。使用 PowerShell 删除所有排除项比在图形用户界面 (GUI) 中手动删除它们要快得多。使用脚本并专注于其他任务。
您喜欢这篇文章吗?您可能还喜欢 Windows 中的安全擦除硬盘驱动器和固态驱动器。不要忘记关注我们并分享这篇文章。
猜你还喜欢
- 03-30 [玩转系统] 如何用批处理实现关机,注销,重启和锁定计算机
- 02-14 [系统故障] Win10下报错:该文件没有与之关联的应用来执行该操作
- 01-07 [系统问题] Win10--解决锁屏后会断网的问题
- 01-02 [系统技巧] Windows系统如何关闭防火墙保姆式教程,超详细
- 12-15 [玩转系统] 如何在 Windows 10 和 11 上允许多个 RDP 会话
- 12-15 [玩转系统] 查找 Exchange/Microsoft 365 中不活动(未使用)的通讯组列表
- 12-15 [玩转系统] 如何在 Windows 上安装远程服务器管理工具 (RSAT)
- 12-15 [玩转系统] 如何在 Windows 上重置组策略设置
- 12-15 [玩转系统] 如何获取计算机上的本地管理员列表?
- 12-15 [玩转系统] 在 Visual Studio Code 中连接到 MS SQL Server 数据库
- 12-15 [玩转系统] 如何降级 Windows Server 版本或许可证
- 12-15 [玩转系统] 如何允许非管理员用户在 Windows 中启动/停止服务
取消回复欢迎 你 发表评论:
- 精品推荐!
-
- 最新文章
- 热门文章
- 热评文章
[影视] 黑道中人 Alto Knights(2025)剧情 犯罪 历史 电影
[古装剧] [七侠五义][全75集][WEB-MP4/76G][国语无字][1080P][焦恩俊经典]
[实用软件] 虚拟手机号 电话 验证码 注册
[电视剧] 安眠书店/你 第五季 You Season 5 (2025) 【全10集】
[电视剧] 棋士(2025) 4K 1080P【全22集】悬疑 犯罪 王宝强 陈明昊
[软件合集] 25年6月5日 精选软件22个
[软件合集] 25年6月4日 精选软件36个
[短剧] 2025年06月04日 精选+付费短剧推荐33部
[短剧] 2025年06月03日 精选+付费短剧推荐25部
[软件合集] 25年6月3日 精选软件44个
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电视剧] 欢乐颂.5部全 (2016-2024)
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[影视] 【稀有资源】香港老片 艺坛照妖镜之96应召名册 (1996)
[剧集] 神经风云(2023)(完结).4K
[剧集] [BT] [TVB] [黑夜彩虹(2003)] [全21集] [粤语中字] [TV-RMVB]
[实用软件] 虚拟手机号 电话 验证码 注册
[资源] B站充电视频合集,包含多位重量级up主,全是大佬真金白银买来的~【99GB】
[影视] 内地绝版高清录像带 [mpg]
[书籍] 古今奇书禁书三教九流资料大合集 猎奇必备珍藏资源PDF版 1.14G
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电影] 美国队长4 4K原盘REMUX 杜比视界 内封简繁英双语字幕 49G
[电影] 死神来了(1-6)大合集!
[软件合集] 25年05月13日 精选软件16个
[精品软件] 25年05月15日 精选软件18个
[绝版资源] 南与北 第1-2季 合集 North and South (1985) /美国/豆瓣: 8.8[1080P][中文字幕]
[软件] 25年05月14日 精选软件57个
[短剧] 2025年05月14日 精选+付费短剧推荐39部
[短剧] 2025年05月15日 精选+付费短剧推荐36部
- 最新评论
-
- 热门tag