Jump to content

add new applications to Windows Firewall


Recommended Posts

@JLogan3o13, I was looking at your Windows Firewall.au3 to get my application added to the firewall to exclude additional pop-ups' for adding the application everytime I launch the applications.

Using the _AddAuthorizedApp, I am able to get the application added to the firewall but it shows as grayed out and unchecked. How can I get it to not gray out, checked and a Check on the DOMAIN box?

I tried using as:

_AddAuthorizedApp("Application Name", "Application path", 2, 1, True)

Could you please help in getting this solved?

Edited by DigDeep
Link to comment
Share on other sites

  • Moderators

I will look at it when I am home from the office, but that UDF was written back during the XP/WIN7 days, and is in serious need of updating.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@Digdeep I found it more reliable to use netsh

 

Func FirewallBlockOutbound($sName, $sPath)
    ;msgbox(0,$sName,"netsh advfirewall firewall add rule name = " & $sName & " dir = out action = block program = " & Chr(34)& $sPath & Chr(34)& " enable = yes")
    RunWait(@ComSpec & " /c " & "netsh advfirewall firewall delete rule name = " & Chr(34) & $sName & Chr(34) & " program = " & Chr(34) & $sPath & Chr(34) & " dir = out", "", @SW_HIDE)
    Run(@ComSpec & " /c " & "netsh advfirewall firewall add rule name = " & Chr(34) & $sName & Chr(34) & " dir = out action = block program = " & Chr(34) & $sPath & Chr(34) & " enable = yes", "", @SW_HIDE) ; don't forget " " before "/c"
    Sleep(100)
EndFunc   ;==>FirewallBlockOutbound

Func FirewallAllowOutbound($sName, $sPath)
    ;msgbox(0,$sName,"netsh advfirewall firewall add rule name = " & $sName & " dir = out action = allow program = " & Chr(34)& $sPath & Chr(34)& " enable = yes")
    RunWait(@ComSpec & " /c " & "netsh advfirewall firewall delete rule name = " & Chr(34) & $sName & Chr(34) & " program = " & Chr(34) & $sPath & Chr(34) & " dir = out", "", @SW_HIDE)
    Run(@ComSpec & " /c " & "netsh advfirewall firewall add rule name = " & Chr(34) & $sName & Chr(34) & " dir = out action = allow program = " & Chr(34) & $sPath & Chr(34) & " enable = yes", "", @SW_HIDE) ; don't forget " " before "/c"
    Sleep(100)
EndFunc   ;==>FirewallAllowOutbound

Func FirewallBlockInbound($sName, $sPath)
    ;msgbox(0,$sName,"netsh advfirewall firewall add rule name = " & $sName & " dir = in action = block program = " & Chr(34)& $sPath & Chr(34)& " enable = yes")
    RunWait(@ComSpec & " /c " & "netsh advfirewall firewall delete rule name = " & Chr(34) & $sName & Chr(34) & " program = " & Chr(34) & $sPath & Chr(34) & " dir = in", "", @SW_HIDE)
    Run(@ComSpec & " /c " & "netsh advfirewall firewall add rule name = " & Chr(34) & $sName & Chr(34) & " dir = in action = block program = " & Chr(34) & $sPath & Chr(34) & " enable = yes", "", @SW_HIDE) ; don't forget " " before "/c"
    Sleep(100)
EndFunc   ;==>FirewallBlockInbound

Func FirewallAllowInbound($sName, $sPath)
    ;msgbox(0,$sName,"netsh advfirewall firewall add rule name = " & $sName & " dir = in action = allow program = " & Chr(34)& $sPath & Chr(34)& " enable = yes")
    RunWait(@ComSpec & " /c " & "netsh advfirewall firewall delete rule name = " & Chr(34) & $sName & Chr(34) & " program = " & Chr(34) & $sPath & Chr(34) & " dir = in", "", @SW_HIDE)
    Run(@ComSpec & " /c " & "netsh advfirewall firewall add rule name = " & Chr(34) & $sName & Chr(34) & " dir = in action = allow program = " & Chr(34) & $sPath & Chr(34) & " enable = yes", "", @SW_HIDE) ; don't forget " " before "/c"
    Sleep(100)
EndFunc   ;==>FirewallAllowInbound

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...