Home » Questions » Computers [ Ask a new question ]

Powershell ping indefinitely

Powershell ping indefinitely

In Powershell is there a better way to ping a host indefinitely besides doing something like this:

Asked by: Guest | Views: 58
Total answers/comments: 2
Guest [Entry]

"while (1) {
ping host
}

This will ping indefinitely until you press Ctrl-C just like ping -t would."
Guest [Entry]

"in windows powershell you can use Test-Connection cmdlet.

This cmdlet sends ICMP echo request packets (""pings"") to one or more
computers using WMI

although it does not have any -t option but it have -count option that u can indicate number of ICMP pocket to send
instead you can use this cmdlet this way:

while (1) {
Test-Connection host
}

and result is like bellow:"