' This script will make changes to Windows Firewall with Advanced Security (WFAS) ' DISCLAIMER: This script is intended for reference only. Just because this worked ' for me, you must assume that this script will probably turn your computer into a ' puddle of molten silicon, or render your system inoperable requiring a full re-install. ' I can not be held liable for damage done to your system by using any of this script. ' REMINDER: Before making any changes to your WFAS rules with this script, Export your ' default WFAS settings ("Restore Default Policy" will not be the same). ' PURPOSE: Create specific WFAS rule, Allow ICMPv4 ping on all profiles, all interfaces ' REFERENCE: http://msdn.microsoft.com/en-us/library/dd745029(VS.85).aspx ' DEVELOPED BY: Jay Ohman, Ohman Automation Corp - www.OhmanCorp.com ' ------------------------------------------------------------------------------------------------- Option Explicit Dim Rule, NewRule, RulesObject, fwPolicy2 WScript.Echo "Windows Firewall with Advanced Security: Enabling ping..." ' Profile Type Const NET_FW_PROFILE2_DOMAIN = 1 Const NET_FW_PROFILE2_PRIVATE = 2 Const NET_FW_PROFILE2_PUBLIC = 4 Const NET_FW_PROFILE2_ALL = 2147483647 ' Protocol Const NET_FW_IP_PROTOCOL_TCP = 6 Const NET_FW_IP_PROTOCOL_UDP = 17 Const NET_FW_IP_PROTOCOL_ICMPv4 = 1 Const NET_FW_IP_PROTOCOL_ICMPv6 = 58 ' Direction Const NET_FW_RULE_DIR_IN = 1 Const NET_FW_RULE_DIR_OUT = 2 ' Action Const NET_FW_ACTION_BLOCK = 0 Const NET_FW_ACTION_ALLOW = 1 Set fwPolicy2 = CreateObject("HNetCfg.FwPolicy2") Set RulesObject = fwPolicy2.Rules Set NewRule = CreateObject("HNetCfg.FWRule") ' ------------------------------------------------------------------------------------------------- WScript.Echo " Adding new rule to allow ICMPv4 ping response" NewRule.Direction = NET_FW_RULE_DIR_IN NewRule.Name = "Core Networking - Allow Ping (ICMPv4-In)" NewRule.Grouping = "@FirewallAPI.dll,-25000" NewRule.Profiles = NET_FW_PROFILE2_ALL NewRule.Enabled = TRUE NewRule.Action = NET_FW_ACTION_ALLOW NewRule.ApplicationName = "System" NewRule.Protocol = NET_FW_IP_PROTOCOL_ICMPv4 NewRule.IcmpTypesAndCodes = "*" NewRule.Description = "Allows v4 ping to respond" NewRule.EdgeTraversal = FALSE NewRule.InterfaceTypes = "All" RulesObject.Add NewRule ' ------------------------------------------------------------------------------------------------- Set fwPolicy2 = Nothing Set RulesObject = Nothing Set NewRule = Nothing WScript.Echo "Done"