# encoding: ascii
# api: powershell
# title: Ping-Host
# description: Simple function that pings a host and returns a boolean.
# version: 0.1
# type: function
# author: dragonmc77
# license: CC0
# function: Ping-Host
# x-poshcode-id: 599
# x-archived: 2014-08-01T17:24:54
# x-published: 2009-09-23T19:12:00
#
#
function Ping-Host {param(	[string]$HostName,
							[int32]$Requests = 3)
	
	for ($i = 1; $i -le $Requests; $i++) {
		$Result = Get-WmiObject -Class Win32_PingStatus -ComputerName . -Filter "Address='$HostName'"
		Start-Sleep -Seconds 1
		if ($Result.StatusCode -ne 0) {return $FALSE}
	}
	return $TRUE
}
