Adding a rule to the Windows firewall

From ISXKB

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
-
If you want to add you application to the "allowed" list in the Windows firewall, you can make use of the Net.exe application built into windows:
+
If you want to add you application to the "allowed" list in the Windows firewall (Windows XP SP2, Vista, ...) and, you can make use of the Net.exe application built into Windows:
 +
This is all one line in Inno Setup:
-
;This is all one line in Inno Setup.
+
    Filename: "{sys}\netsh.exe"; Parameters: "firewall add allowedprogram ""{app}\app.exe"" ""My App desc"" ENABLE ALL";
-
Filename: "{sys}\netsh.exe"; Parameters:
+
     StatusMsg: "My status msg..."; Flags: runhidden; MinVersion: 0,5.01.2600sp2;
-
    "firewall add allowedprogram ""{app}\app.exe"" ""My App desc"" ENABLE ALL";
+
-
     StatusMsg: "My status msg..."; Flags: runhidden
+
-
Please note that this does produce an error about helper DLLs on my machine, but I do not currently have the firewall installed.
+
MinVersion  will take care of running it only for Windows >= WinXP SP2.
 +
 
 +
Ideally you should use a user selectable task for this:
 +
 
 +
    [Tasks]
 +
    ; Firewall starting from Windows XP SP2 (5.01.2600sp2)
 +
    Name: Firewall; Description: "Add an exception to Windows firewall"; MinVersion: 0,5.01.2600sp2;
 +
    ...
 +
    ...
 +
    ...
 +
    [Run]
 +
    Filename: "{sys}\netsh.exe"; .........; Tasks: Firewall;

Revision as of 14:46, 23 January 2007

If you want to add you application to the "allowed" list in the Windows firewall (Windows XP SP2, Vista, ...) and, you can make use of the Net.exe application built into Windows:

This is all one line in Inno Setup:

    Filename: "{sys}\netsh.exe"; Parameters: "firewall add allowedprogram ""{app}\app.exe"" ""My App desc"" ENABLE ALL";
    StatusMsg: "My status msg..."; Flags: runhidden; MinVersion: 0,5.01.2600sp2;

MinVersion will take care of running it only for Windows >= WinXP SP2.

Ideally you should use a user selectable task for this:

   [Tasks]
   ; Firewall starting from Windows XP SP2 (5.01.2600sp2)
   Name: Firewall; Description: "Add an exception to Windows firewall"; MinVersion: 0,5.01.2600sp2; 
   ...
   ...
   ...
   [Run]
   Filename: "{sys}\netsh.exe"; .........; Tasks: Firewall;
Personal tools
Ads: