Open a command prompt using “Run as administrator” (Right mouse click on “Command Prompt” in Accessories.).

Enter:
netsh firewall set icmpsetting 8 enable

In Windows 7, this command has been deprecated and replaced with the following:

netsh advfirewall firewall add rule name=”ICMP Allow incoming V4 echo request” protocol=icmpv4:8,any dir=in action=allow

In Windows Server 2012 R2, to allow RDP access:

netsh advfirewall firewall add rule name=”RDP Allowed” protocol=tcp localport=3389 dir=in action=allow