Option Explicit ' Set constants Const NET_FW_PROFILE_DOMAIN = 0 Const NET_FW_PROFILE_STANDARD = 1 ' Scope Const NET_FW_SCOPE_ALL = 0 ' IP Version – ANY is the only allowable setting for now Const NET_FW_IP_VERSION_ANY = 2 ' Declare variables Dim errornum ' Create the firewall manager object. Dim fwMgr Set fwMgr = CreateObject("HNetCfg.FwMgr") ' Get the current profile for the local firewall policy. Dim profile Set profile = fwMgr.LocalPolicy.CurrentProfile Dim app Set app = CreateObject("HNetCfg.FwAuthorizedApplication") app.ProcessImageFileName = "c:\padawan.exe" app.Name = "Padawan" app.Scope = NET_FW_SCOPE_ALL ' Use either Scope or RemoteAddresses, but not both 'app.RemoteAddresses = "*" app.IpVersion = NET_FW_IP_VERSION_ANY app.Enabled = TRUE ' Use this line if you want to add the app, but disabled. 'app.Enabled = FALSE On Error Resume Next errornum = 0 profile.AuthorizedApplications.Add app errornum = Err.Number if errornum <> 0 then Wscript.Echo("Adding authorized application failed with: " & errornum)