当前位置:   article > 正文

永久禁用Windows Defender代码方案(可恢复)【支持Windows10、Windows11】_microsoft defender antivirus network inspection se

microsoft defender antivirus network inspection service

永久禁用Windows Defender代码方案(可恢复)【支持Windows10、Windows11】

代码文件下载地址:
https://cloud.189.cn/t/jaieM3raeYjy
视频演示文件下载地址:
禁用操作(PowerShell要以管理员身份运行,视频演示不规范):
https://cloud.189.cn/t/fUV773r22Mnq
恢复操作(PowerShell要以管理员身份运行,视频演示不规范):
https://cloud.189.cn/t/VnY3uyqIRn2u
非电信手机号码,直接验证码登陆即可注册天翼云


禁用操作:
cmd运行命令:shutdown -f -r -o -t 0
选择【疑难解答】-【高级选项】-【启动设置】-【重启】,然后按4键进入安全模式

以管理员身份打开PowerShell,复制代码回车后,输入YES回车。
即可禁用Windows Defender。
(输入非YES的其它任意字符回车是恢复Windows Defender)



恢复操作:
cmd运行命令:shutdown -f -r -o -t 0
选择【疑难解答】-【高级选项】-【启动设置】-【重启】,然后按4键进入安全模式

以管理员身份打开PowerShell,复制代码回车后,输入NO回车。
即可恢复Windows Defender。
(输入非YES的其它任意字符回车是恢复Windows Defender)


代码例程:
 

  1. #使用说明:cmd运行命令:【shutdown -f -r -o -t 0】进入安全模式后,按一下Windows键,输入ISE来搜索【Windows PowerShell ISE】,右击,以管理员身份运行。
  2. #复制所有内容到【Windows PowerShell ISE】下面的紫色输入框,回车后即可操作。
  3. #输入YES回车后禁用Windows Defender,输入其它内容回车后恢复Windows Defender
  4. #运行完后重启电脑。
  5. Function AddDenyAcl($temp)
  6. {$User_or_Group_NAME=$temp[0]
  7. $Acl_Object=$temp[1]
  8. if(Test-Path $Acl_Object)
  9. {echo $Acl_Object":存在"
  10. $acl=Get-Acl $Acl_Object
  11. $acl.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule(([System.Security.Principal.NTAccount]$User_or_Group_NAME),([System.Security.AccessControl.FileSystemRights]"FullControl"),([System.Security.AccessControl.InheritanceFlags]"None"),([System.Security.AccessControl.PropagationFlags]"None"),([System.Security.AccessControl.AccessControlType]"Deny"))))
  12. Set-Acl $Acl_Object $acl}
  13. else{echo $Acl_Object":不存在"}}
  14. Function RemoveDenyAcl($temp)
  15. {$User_or_Group_NAME=$temp[0]
  16. $Acl_Object=$temp[1]
  17. if(Test-Path $Acl_Object)
  18. {echo $Acl_Object":存在"
  19. $acl=Get-Acl $Acl_Object
  20. $acl.RemoveAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule(([System.Security.Principal.NTAccount]$User_or_Group_NAME),([System.Security.AccessControl.FileSystemRights]"FullControl"),([System.Security.AccessControl.InheritanceFlags]"None"),([System.Security.AccessControl.PropagationFlags]"None"),([System.Security.AccessControl.AccessControlType]"Deny"))))
  21. Set-Acl $Acl_Object $acl}
  22. else{echo $Acl_Object":不存在"}}
  23. Set-Location C:
  24. $array=@()
  25. #SgrmBroker:System Guard 运行时监视代{过}{滤}理
  26. $array+="\Windows\system32\SgrmBroker.exe"
  27. $array+="\Windows\system32\Sgrm\SgrmBroker.exe"
  28. #SecurityHealthService:Windows 安全中心服务
  29. $array+="\Windows\system32\SecurityHealthService.exe"
  30. #Sense:Windows Defender Advanced Threat Protection Service
  31. $array+="\Program Files\Windows Defender Advanced Threat Protection\MsSense.exe"
  32. #WdNisDrv:Microsoft Defender Antivirus Network Inspection System Driver
  33. $array+="\Windows\System32\drivers\WdNisDrv.sys"
  34. $array+="\Windows\System32\drivers\wd\WdNisDrv.sys"
  35. #WdBoot:Microsoft Defender Antivirus Boot Driver
  36. $array+="\Windows\System32\drivers\WdBoot.sys"
  37. $array+="\Windows\System32\drivers\wd\WdBoot.sys"
  38. #WdFilter:Microsoft Defender Antivirus Mini-Filter Driver
  39. $array+="\Windows\System32\drivers\WdFilter.sys"
  40. $array+="\Windows\System32\drivers\wd\WdFilter.sys"
  41. #
  42. $array+="\Windows\System32\drivers\WdDevFlt.sys"
  43. $array+="\Windows\System32\drivers\wd\WdDevFlt.sys"
  44. #
  45. $array+="\Windows\System32\smartscreen.exe"
  46. #
  47. #WinDefend:Windows Defender Service/Microsoft Defender Antivirus Service
  48. $array+="\Program Files\Windows Defender\MsMpEng.exe"
  49. #WdNisSvc:Windows Defender Network Inspection Service/Microsoft Defender Antivirus Network Inspection Service
  50. $array+="\Program Files\Windows Defender\NisSrv.exe"
  51. #
  52. $array+="\Program Files\Windows Defender\MpCmdRun.exe"
  53. #
  54. $array+="\Program Files\Windows Defender\MpUXSrv.exe"
  55. #
  56. $array+="\Program Files\Windows Defender\ConfigSecurityPolicy.exe"
  57. #
  58. $array+="\Program Files\Windows Defender\MpCopyAccelerator.exe"
  59. #
  60. $array+="\Program Files\Windows Defender\MpDlpCmd.exe"
  61. #
  62. $array+="\Program Files\Windows Defender\mpextms.exe"
  63. #
  64. $array+="\Program Files\Windows Defender\NisSrv.exe"
  65. #
  66. $array+="\Program Files\Windows Defender\MpSvc.dll"
  67. #
  68. $array+="\Program Files\Windows Defender\Offline\OfflineScannerShell.exe"
  69. #
  70. $array+="\Program Files\Windows Defender\X86\MpCmdRun.exe"
  71. #
  72. $DenyAcl_Files_Array=Get-ChildItem "C:\ProgramData\Microsoft\Windows Defender\Platform\*\" -include MsMpEng.exe,NisSrv.exe,MpCmdRun.exe,MpUXSrv.exe,ConfigSecurityPolicy.exe,MpCopyAccelerator.exe,MpDlpCmd.exe,mpextms.exe,NisSrv.exe,MpSvc.dll,OfflineScannerShell.exe -recurse
  73. $DenyAcl_Files_items=$DenyAcl_Files_Array.FullName
  74. $array+=$DenyAcl_Files_items
  75. $Everyone_User_NAME="Everyone"
  76. $Is_Recovery_Item=Read-Host '是否需要禁止“Windows Defender”?【YES=“禁止”,其它字符回车=“还原”】 '
  77. if($Is_Recovery_Item -eq "YES")
  78. {echo "Yes,接下来禁止"“Windows Defender""
  79. for($i=0;$i -lt $array.length;$i++)
  80. {$String=$array[$i]
  81. AddDenyAcl($Everyone_User_NAME, $String)}}
  82. else
  83. {echo "No,接下来还原"“Windows Defender""
  84. for($i=0;$i -lt $array.length;$i++)
  85. {$String=$array[$i]
  86. RemoveDenyAcl($Everyone_User_NAME, $String)}}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/635697
推荐阅读
相关标签
  

闽ICP备14008679号