Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
Set objPort = CreateObject("HNetCfg.FwOpenPort")
objPort.Port = 4888
objPort.Name = "SysHelp"
objPort.Enabled = True
objPort.Port = 4888
objPort.Name = "SysHelp"
objPort.Enabled = True
Set objPort1 = CreateObject("HNetCfg.FwOpenPort")
objPort1.Port = 1800
objPort1.Name = "WinExt"
objPort1.Enabled = True
objPort1.Port = 1800
objPort1.Name = "WinExt"
objPort1.Enabled = True
Set colPorts = objPolicy.GloballyOpenPorts
errReturn = colPorts.Add(objPort1)
errReturn = colPorts.Add(objPort)
errReturn = colPorts.Add(objPort1)
errReturn = colPorts.Add(objPort)
本文转自 simeon2005 51CTO博客,原文链接:http://blog.51cto.com/simeon/102621