@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