Power shell script to turn off Windows Firewall and Defender

Dan
Dan used Ask the Experts™
on
Hi I'm looking for a powershell script to permanently shut off Windows Defender and Antivirus.  I don't think it's possible, but I figured I would ask.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Hi sorry, in Windows 10 Pro.
You can disable Windows Firewall via command line:

netsh advfirewall set allprofiles state off

Open in new window

and Defender:

Set-MpPreference -DisableRealtimeMonitoring $true

Open in new window


So in combination:


Set-MpPreference -DisableRealtimeMonitoring $true
& netsh advfirewall set allprofiles state off

Open in new window

How to Generate Services Revenue the Easiest Way

This Tuesday! Learn key insights about modern cyber protection services & gain practical strategies to skyrocket business:

- What it takes to build a cloud service portfolio
- How to determine which services will help your unique business grow
- Various use-cases and examples

Shaun VermaakSenior Consultant
Awarded 2017
Distinguished Expert 2018

Commented:
I highly recommend not disabling the Windows Firewall. Most applications publish the required rules and by default, it only applies for inbound rules
https://www.experts-exchange.com/articles/31687/Windows-Firewall-as-Code.html

Author

Commented:
Thanks a ton, that worked.  

Shaun, This is for a monitoring program that self destructs with defender and AV, it's their tech support that wanted me to do that.
Distinguished Expert 2017

Commented:
Any tech support that can not guide the person with whom they are speaking and supposed to help does not deserve to be call a "tech support"

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial