1

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.

1
  • Access to a server in terms of permissions or just connectivity across the network? Sep 6, 2011 at 20:56

1 Answer 1

1

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.

1
  • thank a lot. i was struggling with it and was looking to timeout wmi calls
    – Nikhil S
    Sep 7, 2011 at 7:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .