Configure exe exception (VBScript)

This code can be found in Chapter 3 of Windows Server 2003 Networking Recipes

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' From the book "Windows Server 2003 Networking Recipes"

' This code creates a program exception for Standard.exe.
' ------ SCRIPT CONFIGURATION ------
Application.Name = "Standard"
Application.ProcessImageFileName = "c:\folder1\Standard.exe"
' ------ END CONFIGURATION ---------

Set firewall = CreateObject("HNetCfg.FwMgr")
Set firewallPolicy = firewall.LocalPolicy.CurrentProfile
Set Application = CreateObject("HNetCfg.FwAuthorizedApplication")

' IPVersion 2 stands for "any version of IP", this is the only correct value
Application.IPVersion = 2


' A scope of 0 allows the exception for all addresses
Application.Scope = 0

Application.Enabled = TRUE

Set Applications = firewallPolicy.AuthorizedApplications
Applications.Add(Application)
WScript.Echo("Program " & Application.Name & " added successfully!")

This code has been viewed 983 times.

New from the creators of TechTasks.com: StatSheet.com