Solved Netsh firewall issue

Annay

New member
Hi,

I'm trying to add a rule for our program when installing the application. However it doesn't work for a private profile but it does work on a domain profile. Even weirder is when I delete the rule after setup and add the same rule again it does work!

The rule I'm adding during setup (InstallShield) is:

netsh advfirewall firewall add rule name=MyApp dir=in program="c:\myapp\appie.exe" action=allow protocol=UDP edge=deferuser profile=any

When retrieving the rule info (netsh advfirewall firewall show rule name=MyApp) I get:

Rule Name: MyApp
----------------------------------------------------------------------
Enabled: Yes
Direction: In
Profiles: Domain,Private,Public
Grouping:
LocalIP: Any
RemoteIP: Any
Protocol: UDP
LocalPort: Any
RemotePort: Any
Edge traversal: Defer to user
Action: Allow


Like I said when I delete the rule and add it again on the command line it does work but the output when retrieving the info is exactly the same !

TIA,
Erik
 

My Computer

OS
Windows 7 Ultimate x64
CPU
Intel Core2Quad Q8200 2.34 GHz
Memory
4 GB
Graphics Card(s)
Yes
Sound Card
Yes
Screen Resolution
1600x1050 and 1280x1024
Hard Drives
500 GB
500 GB
1.5 TB
Case
Closed
Cooling
Just enough
Keyboard
Yes
Mouse
Yes
Internet Speed
15 Mb/s
Annay,

Any reason why you can't use the power of advanced firewall via the control panel?

Control Panel | Window Firewall | Advanced Setings (left-side pane) |
Left-clk on Inbound Rules | rt-clk and choose New Rule |
Program radio button | NEXT |
in This Program Path enter c:\myapp\appie.exe | NEXT |
Allow the connection radio button | NEXT |
checkmark Domain, Public, and Private boxes | NEXT |
enter MyApp in the Name box | FINISH

Now if you really want to worry about the protocol and edge transversal you can either edit the rule OR back at the dialog where you chose Program, you can choose Custom.
 

My Computer

Computer Manufacturer/Model Number
Toshiba Satellite S875D-S7239 laptop
OS
MS Windows 7 Ultimate SP1 64-bit
CPU
AMD A10-4600M
Motherboard
AMD Pumori (Socket FT1)
Memory
6.00 GB Dual-Channel DDR3 @ 798MHz (11-11-12-28)
Graphics Card(s)
AMD Radeon HD 7660G
Sound Card
High Definition Audio Device
Monitor(s) Displays
Generic PnP Monitor (1600x900@60Hz)
Screen Resolution
1600x900@60Hz
Hard Drives
SSD 119GB Corsair CSSD-V128GB2 ATA Device
Keyboard
Standard PS/2 Keyboard
Mouse
HP Wireless Optical Mobile Mouse Model FHA-3410
Internet Speed
What the local pub, local coffee shop offers.
Other Info
Optical Drive:MATSHITA BD-CMB UJ160B ATA Device


Also have an Asus ha1002xp netbook with Win 7 Ultimate installed.
Well, I need to do it programmatically during install. I can't bother the end-users with adding/modifying entries to the firewall
 

My Computer

OS
Windows 7 Ultimate x64
CPU
Intel Core2Quad Q8200 2.34 GHz
Memory
4 GB
Graphics Card(s)
Yes
Sound Card
Yes
Screen Resolution
1600x1050 and 1280x1024
Hard Drives
500 GB
500 GB
1.5 TB
Case
Closed
Cooling
Just enough
Keyboard
Yes
Mouse
Yes
Internet Speed
15 Mb/s
I suggestyou go ahead and generate your rule using the method I described.

Then try the rule out. Personally, I would block edge transversal.

You can click on your new rule and choose properties. There you will see everything that was set/reset/configured. You can also use the List option and save the list as a .csv file (easier to read than a .txt file). Look at what is there and make corresponding statements in the netsh advfirewall command.

I don't use the netsh advfireall except for the couple of cases where the control panel, wf.msc, or gpedit.msc don't do the job for me.
 

My Computer

Computer Manufacturer/Model Number
Toshiba Satellite S875D-S7239 laptop
OS
MS Windows 7 Ultimate SP1 64-bit
CPU
AMD A10-4600M
Motherboard
AMD Pumori (Socket FT1)
Memory
6.00 GB Dual-Channel DDR3 @ 798MHz (11-11-12-28)
Graphics Card(s)
AMD Radeon HD 7660G
Sound Card
High Definition Audio Device
Monitor(s) Displays
Generic PnP Monitor (1600x900@60Hz)
Screen Resolution
1600x900@60Hz
Hard Drives
SSD 119GB Corsair CSSD-V128GB2 ATA Device
Keyboard
Standard PS/2 Keyboard
Mouse
HP Wireless Optical Mobile Mouse Model FHA-3410
Internet Speed
What the local pub, local coffee shop offers.
Other Info
Optical Drive:MATSHITA BD-CMB UJ160B ATA Device


Also have an Asus ha1002xp netbook with Win 7 Ultimate installed.
Thanx for the info! I forgot all about the advanced settings screen. It gives more detailed info then the logging of netsh. It appeared that the installer was adding the rule without path info. It's working fine now.
 

My Computer

OS
Windows 7 Ultimate x64
CPU
Intel Core2Quad Q8200 2.34 GHz
Memory
4 GB
Graphics Card(s)
Yes
Sound Card
Yes
Screen Resolution
1600x1050 and 1280x1024
Hard Drives
500 GB
500 GB
1.5 TB
Case
Closed
Cooling
Just enough
Keyboard
Yes
Mouse
Yes
Internet Speed
15 Mb/s
Back
Top