SHARE
TWEET

Untitled

a guest Feb 18th, 2019 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. netsh firewall set icmpsetting 8
  2.    
  3. netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request"
  4.     protocol=icmpv4:8,any dir=in action=allow
  5.    
  6. # allow-icmp.ps1
  7. # Sets up windows firewall to allow inbound ICMP - using PowerShell
  8. # Thomas Lee - tfl@psp.co.uk
  9.  
  10. #create firewall manager object
  11. $FWM=new-object -com hnetcfg.fwmgr
  12.  
  13. # Get current profile
  14. $pro=$fwm.LocalPolicy.CurrentProfile
  15.  
  16. # Check Profile
  17. if ($pro.IcmpSettings.AllowInboundEchoRequest) {
  18.     "Echo Request already allowed"
  19. } else {
  20.     $pro.icmpsettings.AllowInboundEchoRequest=$true
  21. }
  22.  
  23. # Display ICMP Settings
  24. "Windows Firewall - current ICMP Settings:"
  25. "-----------------------------------------"
  26. $pro.icmpsettings
  27.    
  28. netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
  29.    
  30. Set-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -enabled True
  31. Set-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv6-In)" -enabled True
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top