Home Dashboard Directory Help
Search

-Continuous switch with Test-Connection cmdlet by Ravikanth.Chaganti


Status: 

Active


41
2
Sign in
to vote
Type: Suggestion
ID: 676600
Opened: 6/23/2011 1:39:23 AM
Access Restriction: Public
0
Workaround(s)
view

Description

During my regular work, I keep using Ping -t a lot as Test-Connection has no -continuous parameter. This is essential for monitoring a system for continuous connection until it comes online or goes offline. With a -continuous switch, we can easily create an event based triggering mechanism. For example,

While (Test-Connection -cn Server01 -Continuous -Quiet) {
#may be sleep
}
#and here use New-Event to raise an event for the connection loss
#Do something with the event
And, this can be used in a background job to monitor systems async.

We can create a proxy function today to do this. But, having the cmdlet implement this mechanism will be appropriate. There were also suggestions to use count parameter with a BIG number. But, count is count. It does not mean forever or until an event occurs.

So, I suggest that PowerShell vNext to include -Continuous parameter with Test-Connection cmdlet. When a user does not want to ping anymore, he/she will just press CTRL+C and break the session.
Details
Sign in to post a comment.
Posted by Robert Heinig II on 8/14/2012 at 4:51 AM
I'd suggest supporting all or most options of ping.exe, especially -w, -4 and -6. -t is at least easy to approximate.
Sign in to post a workaround.