General discussion

Locked

How to add .exe file to windows firewall

By wil henriquez ·
The limit of 40 characters did not allowed me to state my question in a better way.

I would like to know what is the best scripting way to populate the windows firewall exceptions with executable files.

Is there a best type of script more suitable for this task, i.e. WSH, Kixstart

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by HAL 9000 Moderator In reply to How to add .exe file to w ...

This may prove useful

http://tinyurl.com/7xoef

Col

Collapse -

by wil henriquez In reply to How to add .exe file to w ...

Thanks, Hal.

I have about 100 files that I would like to add to the exceptions list and I would like to automate the task. Any suggestions?

Collapse -

by faradhi In reply to How to add .exe file to w ...

Here is a link to a script that will do what you want.

http://www.microsoft.com/technet/scriptcenter/solutions/appcompat/openprograms-com-vbs.mspx

Collapse -

by larryhyman In reply to How to add .exe file to w ...

here is a sample script from microsoft more info can be found at this URL

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ics/ics/windows_firewall_start_page.asp

and this one:

http://www.microsoft.com/technet/prodtechnol/winxppro/deploy/depfwset/wfsp2ngp.mspx

here is the script:

option explicit

Dim CurrentProfile

' Protocol
Const NET_FW_IP_PROTOCOL_TCP = 6

'Action
Const NET_FW_ACTION_ALLOW = 1

' Create the FwPolicy2 object.
Dim fwPolicy2
Set fwPolicy2 = CreateObject("HNetCfg.FwPolicy2")

' Get the Rules object
Dim RulesObject
Set RulesObject = fwPolicy2.Rules

CurrentProfile = fwPolicy2.CurrentProfileTypes

'Create a Rule Object.
Dim NewRule
Set NewRule = CreateObject("HNetCfg.FWRule")

NewRule.Name = "My Application Name"
NewRule.Description = "Allow my application network traffic"
NewRule.Applicationname = "%systemDrive%\\Program Files\\MyApplication.exe"
NewRule.Protocol = NET_FW_IP_PROTOCOL_TCP
NewRule.LocalPorts = 4000
NewRule.Enabled = TRUE
NewRule.Grouping = "@firewallapi.dll,-23255"
NewRule.Profiles = CurrentProfile
NewRule.Action = NET_FW_ACTION_ALLOW

'Add a new rule
RulesObject.Add NewRule

Collapse -

by wil henriquez In reply to How to add .exe file to w ...

Faradhi,thanks for your help.
I think your link points exactly to what I'm looking for.

Back to Windows Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums