No announcement yet.

Disable windows Firewall

  • Filter
  • Time
  • Show
Clear All
new posts

  • Disable windows Firewall

    ' ---------------------------------------------------------------
     Set objFirewall = CreateObject("HNetCfg.FwMgr")
     Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
     objPolicy.FirewallEnabled = FALSE
    This seems to disable the firewall for the current user? but is there a way to disable it for all without group policy...?
    when other users are logging in it seems to be setting it back to on...
    This is my signature.

  • #2
    Re: Disable windows Firewall

    You can not run this script as as user logon or user logoff scripts, because you must be a local administrator to manage the Firewall. If your users are not local administrators, logon or logoff scripts wonít do you any good; thatís because those scripts run under the security context of the user logging on or logging off.
    Computer startup and shutdown scripts, by contrast, run under the LocalSystem account; consequently, these scripts can be used to manage the Firewall.


    Copy the script to each computer first, then execute it from that computer, by using a startup/shutdown script.


    This posting is provided "AS IS" with no warranties, and confers no rights.


    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts


    • #3
      Re: Disable windows Firewall

      Ah, I had this running with an auto-it to use admin credientials to run..
      but still when I logged off and back on with another user it seemed to turn itself back on
      This is my signature.


      • #4
        Re: Disable windows Firewall

        If you use psexec, it allows you to run the script on the local machine which has worked for me in the past. The only problem is, if ICS is not on, then you will not be able to contact the machine. Psexec has to be in the same directory as this script:

        Set objShell = CreateObject("Wscript.Shell")
        strComputer = InputBox("Enter the PC Name or IP:")
        If strComputer = "" Then
        End If
        objShell.Run "%comspec% /C psexec.exe \\" & strComputer &" netsh firewall set service REMOTEADMIN", 0
        objShell.Run "%comspec% /C psexec.exe \\" & strComputer &" netsh firewall set opmode disable disable", 0
        objShell.Popup "PC's Windows Firewall is now disabled", vbOKCancel + vbInformation
        Set objShell = Nothing
        Last edited by ekrengel; 7th February 2008, 15:59.


        • #5
          Re: Disable windows Firewall

          Two ways to do this:
          1. Use GPO disable Windows Firewall service.
          2. Use GPO logon script to disable/stop Windows Firewall service.
          Hope useful