http://msdn.microsoft.com/library/en-us ... cation.asp
Code: Select all
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 = "%PROGRAMFILES%\Outlook Express\msimn.exe"
app.Name = "Outlook Express"
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)
Code: Select all
; beginning with interface
;
; Interface generated by Interface Generator 1.0, Date 05/25/2005
; NetFwTypeLib,
; Enumerations
Enumeration ; NET_FW_IP_VERSION_
#NET_FW_IP_VERSION_V4 = 0
#NET_FW_IP_VERSION_V6 = 1
#NET_FW_IP_VERSION_ANY = 2
#NET_FW_IP_VERSION_MAX = 3
EndEnumeration
Enumeration ; NET_FW_SCOPE_
#NET_FW_SCOPE_ALL = 0
#NET_FW_SCOPE_LOCAL_SUBNET = 1
#NET_FW_SCOPE_CUSTOM = 2
#NET_FW_SCOPE_MAX = 3
EndEnumeration
Enumeration ; NET_FW_IP_PROTOCOL_
#NET_FW_IP_PROTOCOL_TCP = 6
#NET_FW_IP_PROTOCOL_UDP = 17
EndEnumeration
Enumeration ; NET_FW_SERVICE_TYPE_
#NET_FW_SERVICE_FILE_AND_PRINT = 0
#NET_FW_SERVICE_UPNP = 1
#NET_FW_SERVICE_REMOTE_DESKTOP = 2
#NET_FW_SERVICE_NONE = 3
#NET_FW_SERVICE_TYPE_MAX = 4
EndEnumeration
Enumeration ; NET_FW_PROFILE_TYPE_
#NET_FW_PROFILE_DOMAIN = 0
#NET_FW_PROFILE_STANDARD = 1
#NET_FW_PROFILE_CURRENT = 2
#NET_FW_PROFILE_TYPE_MAX = 3
EndEnumeration
; DispInterfaces
Interface INetFwRemoteAdminSettings Extends IDispatch
get_IpVersion(a)
put_IpVersion(a)
get_Scope(a)
put_Scope(a)
get_RemoteAddresses(a)
put_RemoteAddresses(a)
get_Enabled(a)
put_Enabled(a)
EndInterface
Interface INetFwIcmpSettings Extends IDispatch
get_AllowOutboundDestinationUnreachable(a)
put_AllowOutboundDestinationUnreachable(a)
get_AllowRedirect(a)
put_AllowRedirect(a)
get_AllowInboundEchoRequest(a)
put_AllowInboundEchoRequest(a)
get_AllowOutboundTimeExceeded(a)
put_AllowOutboundTimeExceeded(a)
get_AllowOutboundParameterProblem(a)
put_AllowOutboundParameterProblem(a)
get_AllowOutboundSourceQuench(a)
put_AllowOutboundSourceQuench(a)
get_AllowInboundRouterRequest(a)
put_AllowInboundRouterRequest(a)
get_AllowInboundTimestampRequest(a)
put_AllowInboundTimestampRequest(a)
get_AllowInboundMaskRequest(a)
put_AllowInboundMaskRequest(a)
get_AllowOutboundPacketTooBig(a)
put_AllowOutboundPacketTooBig(a)
EndInterface
Interface INetFwOpenPort Extends IDispatch
get_Name(a)
put_Name(a)
get_IpVersion(a)
put_IpVersion(a)
get_Protocol(a)
put_Protocol(a)
get_Port(a)
put_Port(a)
get_Scope(a)
put_Scope(a)
get_RemoteAddresses(a)
put_RemoteAddresses(a)
get_Enabled(a)
put_Enabled(a)
get_BuiltIn(a)
EndInterface
Interface INetFwOpenPorts Extends IDispatch
get_Count(a)
Add(a)
Remove(a,b)
Item(a,b,c)
get__NewEnum(a)
EndInterface
Interface INetFwService Extends IDispatch
get_Name(a)
get_Type(a)
get_Customized(a)
get_IpVersion(a)
put_IpVersion(a)
get_Scope(a)
put_Scope(a)
get_RemoteAddresses(a)
put_RemoteAddresses(a)
get_Enabled(a)
put_Enabled(a)
get_GloballyOpenPorts(a)
EndInterface
Interface INetFwServices Extends IDispatch
get_Count(a)
Item(a,b)
get__NewEnum(a)
EndInterface
Interface INetFwAuthorizedApplication Extends IDispatch
get_Name(a)
put_Name(a)
get_ProcessImageFileName(a)
put_ProcessImageFileName(a)
get_IpVersion(a)
put_IpVersion(a)
get_Scope(a)
put_Scope(a)
get_RemoteAddresses(a)
put_RemoteAddresses(a)
get_Enabled(a)
put_Enabled(a)
EndInterface
Interface INetFwAuthorizedApplications Extends IDispatch
get_Count(a)
Add(a)
Remove(a)
Item(a,b)
get__NewEnum(a)
EndInterface
Interface INetFwProfile Extends IDispatch
get_Type(a)
get_FirewallEnabled(a)
put_FirewallEnabled(a)
get_ExceptionsNotAllowed(a)
put_ExceptionsNotAllowed(a)
get_NotificationsDisabled(a)
put_NotificationsDisabled(a)
get_UnicastResponsesToMulticastBroadcastDisabled(a)
put_UnicastResponsesToMulticastBroadcastDisabled(a)
get_RemoteAdminSettings(a)
get_IcmpSettings(a)
get_GloballyOpenPorts(a)
get_Services(a)
get_AuthorizedApplications(a)
EndInterface
Interface INetFwPolicy Extends IDispatch
get_CurrentProfile(a)
GetProfileByType(a,b)
EndInterface
Interface INetFwMgr Extends IDispatch
get_LocalPolicy(a)
get_CurrentProfileType(a)
RestoreDefaults()
IsPortAllowed(a,b,c,d,e,f,g)
IsIcmpTypeAllowed(a,b,c,d,e)
EndInterface
Interface INetFwMgrPrivate Extends INetFwMgr
GetScratchPolicy(a,b)
EndInterface
;any way ???


