I'll keep it as short and sweet as possible. This script makes use of HNetCfg.FwMgr to turn your firewall on or off, by using "/firewall on" or "/firewall off" respectively. Initially this was just my toying around but I figured it may be of use to those who want to learn COM. Should you tend to poke around on SwiftIRC you'll notice the same alias posted under Champagne, my IRC name.
alias firewall {
if ($$1 = on || $$1 = off) {
var %f $ticks, %ff f $+ %f, %fff ff $+ %ff, %i, %b $iif($$1 = on,true,false)
if (!$com(%f)) .comopen %f HNetCfg.FwMgr
if (!$comerr) {
.comclose %f $com(%f,LocalPolicy,3,dispatch* %ff)
if ($com(%ff)) {
.comclose %ff $com(%ff,CurrentProfile,3,dispatch* %fff)
if ($com(%fff)) {
%i = $com(%fff,FirewallEnabled,5,bool,%b)
%i = $com(%fff,FirewallEnabled,3)
echo -s Firewall Enabled: $com(%fff).result
.comclose %fff
}
}
}
}
}