' From: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ics/ics/wf_adding_an_application.asp Option Explicit if WScript.arguments.length = 0 then WScript.echo "Please supply the name of the executable to be added to the" WScript.echo "Windows Firewall exception list. It must be in the" WScript.echo "current directory." WScript.echo "Example usage: FirewallExceptionRemove.vbs TrafficCam_Viewer_service.exe" WScript.quit end if ' 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 ' Build the path to the executable Dim WshShell Dim FullPathToService Set WshShell = WScript.CreateObject("WScript.Shell") FullPathToService = WshShell.CurrentDirectory + "\" + Wscript.arguments.item(0) Dim app Set app = CreateObject("HNetCfg.FwAuthorizedApplication") app.ProcessImageFileName = FullPathToService On Error Resume Next errornum = 0 profile.AuthorizedApplications.Remove app.ProcessImageFileName errornum = Err.Number if errornum <> 0 then Wscript.Echo("Deleting authorized application failed with: " & errornum)