Opens port 9999 in the Windows Firewall current profile
Set objFirewall = CreateObject("HNetCfg.FwMgr")Set objPolicy = objFirewall.LocalPolicy.CurrentProfileSet objPort = CreateObject("HNetCfg.FwOpenPort")objPort.Port = 9999objPort.Name = "Test Port"objPort.Enabled = FALSESet colPorts = objPolicy.GloballyOpenPortserrReturn = colPorts.Add(objPort)
This is a VB Script, this can be used by saving the file in .vbs file