mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-22 20:51:17 +01:00
Updated ping-host.ps1
This commit is contained in:
parent
982debb892
commit
78ceb4bd18
@ -7,7 +7,7 @@
|
|||||||
Specifies the hostname or IP address to ping (x.com by default)
|
Specifies the hostname or IP address to ping (x.com by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./ping-host.ps1 x.com
|
PS> ./ping-host.ps1 x.com
|
||||||
✅ Host 'x.com' at IP 104.244.42.1 is up with 20ms latency.
|
✅ Host 'x.com' with 20ms latency at IP 104.244.42.1 is up 👍
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -22,7 +22,7 @@ try {
|
|||||||
[Threading.Tasks.Task]::WaitAll($tasks)
|
[Threading.Tasks.Task]::WaitAll($tasks)
|
||||||
foreach($ping in $tasks.Result) {
|
foreach($ping in $tasks.Result) {
|
||||||
if ($ping.Status -eq "Success") {
|
if ($ping.Status -eq "Success") {
|
||||||
Write-Output "✅ Host '$hostname' at IP $($ping.Address) is up with $($ping.RoundtripTime)ms latency."
|
Write-Output "✅ Host '$hostname' with $($ping.RoundtripTime)ms latency at IP $($ping.Address) is up 👍"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} else {
|
} else {
|
||||||
Write-Output "⚠️ No reply from '$hostname' (IP $($ping.Address)) - check the connection or maybe the host is down."
|
Write-Output "⚠️ No reply from '$hostname' (IP $($ping.Address)) - check the connection or maybe the host is down."
|
||||||
|
Loading…
Reference in New Issue
Block a user