Share via


command line option for disabling Windows defender in Windows 10

Question

Wednesday, June 1, 2016 10:15 AM

I have a bat file I use to change power settings, turn off windows firewall and would like to add a command to my bat file to disable Windows defender in Windows 10.

We use MDT to push out software to our newly imaged computers and Windows defender is causing problems with one of our software packages from deploying.

I would like to add the syntax to the bat file I have now so it will be less times I am touching each computer.

All replies (4)

Thursday, June 2, 2016 5:57 AM âś…Answered | 1 vote

Hi abctech50,

To disable Windows Defender real-time capabilities, we could take use of the Powershell command posted by ClearWindows7

Powershell command reference:

https://technet.microsoft.com/en-us/library/dn433280.aspx

Turn off Windows Defender would change the registry below:

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender

DisableAntiSpyware DWORD

(delete) = On
1 = Off

You could add a reg add command to add this value, format shoud be:

Reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender" /v DisableAntiSpyware /t REG_DWORD /d 1 /f

Reg add command reference:

https://technet.microsoft.com/en-us/library/cc742162%28v=ws.11%29.aspx?f=255&MSPPError=-2147217396

If any further help needed, please post back.

Regards

Please mark the reply as an answer if you find it is helpful.

If you have feedback for TechNet Support, contact [email protected]


Wednesday, June 1, 2016 2:43 PM | 1 vote

It appears that it may be possible with Powershell. So perhaps you can execute a Powershell script from your bat file, if it must be done from a batch script.

The command appears to be: 

Set-MpPreference -DisableRealtimeMonitoring $true

I haven't tested it myself, but give it a go and see what you find.


Wednesday, June 1, 2016 3:38 PM

I have seen other ways of doing this I was hoping to add it to the one bat file I have so I don't have to touch the computer multiple times. I ship out a hundred plus new desktops a month so the less I have to touch each one the better.

Thanks for the help


Monday, December 23, 2019 10:25 PM

In order for this command to run, you must perform the following actions:

1. Run Powershell as an administrator

2. Set-ExecutionPolicy bypass

3. type A for all when prompted, not Y for yes, A for All

4. run the command Set-MpPreference -DisableRealtimeMonitoring $true

This will disable it

Raymond Johnson - Desktop Support Engineer