Enable Ping

I’ve got a few talks coming up so need to build some more demo machines.  One thing I like to be able to do in the demo environment is ping between machines – sometimes necessary when testing things out but ping is disabled by the Windows firewall in Windows 2008 & R2.

James O’Neill has blogged about working with the Windows firewall at http://blogs.technet.com/jamesone/archive/2009/02/18/how-to-manage-the-windows-firewall-settings-with-powershell.aspx

To just set ping on

001
002
003
004
005
006
007
008
009
$fw = New-Object -ComObject HNetCfg.FWPolicy2
#$fw.Rules | Format-Table Name, Enabled, Direction -AutoSize

$fw.Rules | where {$_.Name -like "File and Printer Sharing (Echo Request – ICMPv4-In)"} | 
foreach {$_.Enabled = $true}

$fw.Rules | where {$_.Name -like "File and Printer Sharing (Echo Request – ICMPv4-In)"} | 
Format-Table Name, Direction, Protocol, Profiles, Enabled -AutoSize

Use the HNetCfg.FWPolicy2  COM object  and enable the rules for "File and Printer Sharing (Echo Request – ICMPv4-In)".  There are similar rules for IPv6 if needed.  Blocking pings is just the opposite.

Technorati Tags: ,,

About these ads
This entry was posted in Powershell. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s