As per the proxy on & off script, this does the same with Windows Firewall!!
It Enables or Disables the firewall!! Some users need the firewall on for VPN applications when at home:
Note: This script enables a service so the user will need the relevant permissions!!
On:
On Error Resume Next Set objFwMgr = CreateObject("HNetCfg.FwMgr") If Err <> 0 Then WScript.Echo "Unable to connect to Windows Firewall." WScript.Quit End If Set objProfile = objFwMgr.LocalPolicy.CurrentProfile If objProfile.FirewallEnabled = False Then WScript.Echo "Windows Firewall is Disabled." objProfile.FirewallEnabled = True WScript.Echo "Windows Firewall now Enabled." Else WScript.Echo "Windows Firewall already Enabled." End If
Off:
On Error Resume Next Set objFwMgr = CreateObject("HNetCfg.FwMgr") If Err <> 0 Then WScript.Echo "Unable to connect to Windows Firewall." WScript.Quit End If Set objProfile = objFwMgr.LocalPolicy.CurrentProfile If objProfile.FirewallEnabled = True Then WScript.Echo "Windows Firewall is enabled." objProfile.FirewallEnabled = False WScript.Echo "Windows Firewall now disabled." Else WScript.Echo "Windows Firewall already disabled." End If
Note: Think this script was made by the MS scripting guys!
Leave a Reply