Advertisement
PC_Aide

add new rule firewall.bat

Jan 5th, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.46 KB | None | 0 0
  1. :: ----------------------------------------------------------------------------------------------------------------
  2. :: SRC: https://www.itprotoday.com/windows-8/top-10-windows-firewall-netsh-commands
  3. :: man: https://ss64.com/nt/netsh.html
  4. ::
  5. :: Syntax:
  6. :: Elevated : yes
  7. ::
  8. ::man -> manual
  9. :: ----------------------------------------------------------------------------------------------------------------
  10.  
  11. ::LocalPort (O/P -> https://imgur.com/ytOxIk6)
  12. netsh advfirewall firewall add rule name=OpenWsus8530 dir=in action=allow protocol=tcp localPort=8530
  13.  
  14. ::Domain
  15.  
  16. ::Find rule name (? no regex permit)
  17. :: O/P --> http://pix.toile-libre.org/upload/original/1547396084.png
  18. netsh advfirewall firewall show rule name=all | findstr /i "name Rule:" | findstr /i "nameRule* "
  19.  
  20. ::Reset firewall default
  21. netsh advfirewall reset
  22.  
  23. ::Delete rule
  24. netsh advfirewall firewall delete rule name="Open SQL Server Port 1433" protocol=tcp localport=1433
  25.  
  26. ::Allow ping (default rule disabled)
  27. :: O/P --> http://pix.toile-libre.org/upload/original/1547394676.png
  28. netsh advfirewall firewall set rule name="file and printer sharing (echo request - icmpv4-in)" new enable=yes
  29.  
  30. ::Create youself
  31. ::O/P -> https://imgur.com/44FKhVD
  32. Netsh advfirewall firewall add rule name=”Allow ping” dir=in protocol=icmpV4:8,any action=allow profile=domain
  33.  
  34. ::Export/Import firewall
  35. netsh advfirewall export "C:\temp\WFconfiguration.wfw" 
  36. netsh advfirewall import "C:\temp\WFconfiguration.wfw"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement