Thursday, December 25, 2008

Open a Closed Port

Opens closed port 9999 for the Windows Firewall current profile

Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
Set colPorts = objPolicy.GloballyOpenPorts
Set objPort = colPorts.Item(9999,6)
objPort.Enabled = TRUE

This is a VB Script, this can be used by saving the file in .vbs file