PoSh V2 - Testing Connectivity

Powershell V2 includes a new cmdlet called Test-Connection, that is basically PING. It can be used to stop processing a command if a required computer is not available. Here is the syntax I used:

$computer = "localhost"
$connection = Test-Connection -ComputerName $computer -Quiet -Count 2

If ($connection) {
Write-Host "$computer is available"
} else {
Write-Host "$computer is not available"

Popular posts from this blog

Get local computer UUID/GUID using Windows Powershell

gPLink and gPOptions

PSLoggedOn Getting Started on Windows Server 2008 R2