Jump to content
DigDeep

add new applications to Windows Firewall

Recommended Posts

DigDeep
Posted (edited)

@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

Share this post


Link to post
Share on other sites
JLogan3o13

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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Bilgus

@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

 

  • Like 2

Share this post


Link to post
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

×