New
#1
script to disable firewall
I am looking for a way to disable firewall.
I need help from script expert to make a script or batch to disable firewall for testing purposes please.
I am looking for a way to disable firewall.
I need help from script expert to make a script or batch to disable firewall for testing purposes please.
Hello @samerrustom,
I assume that you are talking aboutWindows Defender Firewall
?
It would probably be best to disable theWindows Defender Firewall Profiles
so that theService
is still available and running, or is thatNOT
what you want ?
In a Batch Script [ with Admin Privileges ] you would use something like :
Code:Turn OFF : NetSh AdvFirewall set AllProfiles State Off Turn ON : NetSh AdvFirewall set AllProfiles State On Check STATUS : @echo off & NetSh AdvFirewall Show AllProfiles State | find /I " ON" >nul && (echo ^> Firewall Status: ON) || echo ^> Firewall Status: OFF
I hope this helps.
Or (elevated) PowerShell:
Hope this helps...Code:Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
thank you @RickC your powershell command disabled the firewall, but i need a script (batch) for testing purposes.
- - - Updated - - -
Hi @Paul Black sorry for respond.
Thank you for your comment. I pasted the provided script to a notepad file then saved it with .bat extension.
I ran the command several times (run as admin), but the firewall is still enabled.
Please let me know if I did something wrong.
- - - Updated - - -
Hi @Paul Black
It is my fault I copied both commands into the same batch file. I understood that I have to copy of the below command into the script file.
I copied the (Check STATUS) command into another script file but it is not giving an info or message. Do I need to add it to the Turn OFF or Turn ON script please?
Turn OFF : NetSh AdvFirewall set AllProfiles State Off
Turn ON : NetSh AdvFirewall set AllProfiles State On
Check STATUS : @echo off & NetSh AdvFirewall Show AllProfiles State | find /I " ON" >nul && (echo ^> Firewall Status: ON) || echo ^> Firewall Status: OFF
Hello @samerrustom,
I didNOT
realise that you areNOT
familiar with Batch Scripts, sorry.
Part of what I posted were the descriptions / information. The ACTUAL Script to use are as follows:
Turn OFF:
Turn ON:Code:NetSh AdvFirewall set AllProfiles State Off
Check STATUS:Code:NetSh AdvFirewall set AllProfiles State On
Code:@echo off & NetSh AdvFirewall Show AllProfiles State | find /I " ON" >nul && (echo ^> Firewall Status: ON) || echo ^> Firewall Status: OFF
I hope this helps.