Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Whenever I use Get-Service with a user that does not have access on the target server it takes a large amount of time to timeout. This is results in an increased amount of time necessary to run a script

Is there a way to find out if a user has access on the target sever? I want to use that kind of functionality in my script to decrease the amount of system resources necessary.

Any and all help is greatly appreciated.

share|improve this question
Access to a server in terms of permissions or just connectivity across the network? – Christopher Sep 6 '11 at 20:56
up vote 1 down vote accepted

Test-Connection (TechNet article here) sends ICMP packets to check for response across the network. It is a PowerShell 2.0 cmdlet.

So if you do:

Test-Connection -count 2 -quiet

it will send 2 ICMP packets and return $true if any are successful or $false if all are dropped.

share|improve this answer
thank a lot. i was struggling with it and was looking to timeout wmi calls – Nikhil S Sep 7 '11 at 7:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.