Listing 3: ToggleFirewall.vbs Option Explicit ' Create the firewall policy object and ' identify the current profile Dim fwPolicy2 Set fwPolicy2 = CreateObject("HNetCfg.FwPolicy2") Dim currentProfile currentProfile = fwPolicy2.CurrentProfileTypes ' Toggle the firewall for the current profile if TRUE = fwPolicy2.FirewallEnabled(currentProfile) then WScript.Echo "Disabling the Windows Firewall ..." fwPolicy2.FirewallEnabled(currentProfile) = FALSE else WScript.Echo "Enabling the Windows Firewall ..." fwPolicy2.FirewallEnabled(currentProfile) = TRUE end if