Updated ping-host.ps1 and enter-host.ps1

This commit is contained in:
Markus Fleschutz 2024-11-04 20:34:49 +01:00
parent cf34f7dae2
commit cd3ad88b65
2 changed files with 5 additions and 2 deletions

View File

@ -31,7 +31,10 @@ try {
} }
& "$PSScriptRoot/ping-host.ps1" $remoteHost & "$PSScriptRoot/ping-host.ps1" $remoteHost
if ($lastExitCode -ne "0") { exit 1 } if ($lastExitCode -ne "0") {
Write-Host "Let's try to wake '$remoteHost' up..."
& "$PSScriptRoot/wake-up-host.ps1"
}
Write-Host "⏳ Connecting as user '$remoteUser' using " -noNewline Write-Host "⏳ Connecting as user '$remoteUser' using " -noNewline
& ssh -V & ssh -V

View File

@ -27,7 +27,7 @@ function GetPingLatency([string]$hostname) {
try { try {
[int]$latency = GetPingLatency($hostname) [int]$latency = GetPingLatency($hostname)
if ($latency -eq 1500) { if ($latency -eq 1500) {
Write-Host "⚠️ Host '$hostname' doesn't respond - check the connection or wake the host up." Write-Host "⚠️ Host '$hostname' doesn't respond - check the connection or maybe the host is down."
exit 1 exit 1
} }
Write-Host "$hostname is up and running ($($latency)ms latency)." Write-Host "$hostname is up and running ($($latency)ms latency)."