script to disable firewall


  1. Posts : 38
    windows 8.1
       #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.
      My Computer


  2. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #2

    Hello @samerrustom,

    samerrustom said:
    I am looking for a way to disable firewall.
    . . . disable firewall for testing purposes please.
    I assume that you are talking about Windows Defender Firewall ?

    It would probably be best to disable the Windows Defender Firewall Profiles so that the Service is still available and running, or is that NOT 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.
      My Computer


  3. Posts : 1,748
    Windows 10 Pro (+ Windows 10 Home VMs for testing)
       #3

    Or (elevated) PowerShell:
    Code:
    Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
    Hope this helps...
      My Computer


  4. Posts : 9,778
    Mac OS Catalina
       #4

    samerrustom said:
    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.
    You do not need a script. Really do not know why you would want to open the machine up to problems when the firewall is there to protect it.
      My Computer


  5. Posts : 38
    windows 8.1
    Thread Starter
       #5

    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
      My Computer


  6. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #6

    Hello @samerrustom,

    I did NOT realise that you are NOT familiar with Batch Scripts, sorry.

    Part of what I posted were the descriptions / information. The ACTUAL Script to use are as follows:

    Turn OFF:
    Code:
    
    NetSh AdvFirewall set AllProfiles State Off
    Turn ON:
    Code:
    
    NetSh AdvFirewall set AllProfiles State On
    Check STATUS:
    Code:
    
    @echo off & NetSh AdvFirewall Show AllProfiles State | find /I " ON" >nul && (echo ^> Firewall Status: ON) || echo ^> Firewall Status: OFF

    I hope this helps.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 02:24.
Find Us




Windows 10 Forums