If you’ve used ping before you’ll know that it normally returns four replies from the target. In PowerShell we have Test-Connection which does the same job. It also normally returns four replies.
When I’m working with remote machines I often want to check they are available before sending a command – especially a WMI command that can take a long time to time out.
To speed up the process use the –Count parameter on test-connection and only get 1 reply. Quick test to see if he system is there and then run the rest of the code