PowerShell: Fast dead host detection (Fast ping)

Before you continue please consider clicking on one of the horrible ads. I know they are a pain but they help me pay for the hosting of this site. It owes me a lot of money. Sob story over.

If you are iterating through hundreds of servers a ping or test connection timeout can add a long wait to your script.

The following code utilizes the job functions in PowerShell to shorten the wait for a dead host to 1 second which makes things a lot faster. Enjoy

Function Fast-Ping
    param ($ipaddress)

    $Result = test-connection $ipaddress -count 1 -asjob  | Wait-Job -Timeout 1 | receive-job  
    stop-job -Name * | remove-job -Name *

    if($Result.responsetime -eq $Null)
    {return $false}Else{return $True}