mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 07:53:21 +01:00
Fixed enter-host.ps1
This commit is contained in:
parent
b6e703d96e
commit
6419712ff2
@ -27,14 +27,14 @@ try {
|
|||||||
$remoteUser = $(whoami)
|
$remoteUser = $(whoami)
|
||||||
} else {
|
} else {
|
||||||
$remoteUser = $env:USERNAME
|
$remoteUser = $env:USERNAME
|
||||||
|
$remoteUser = $remoteUser.toLower()
|
||||||
}
|
}
|
||||||
$username = $username.toLower()
|
|
||||||
|
|
||||||
Write-Host "⏳ Connecting to '$remoteHost' as user '$username' using " -noNewline
|
Write-Host "⏳ Connecting to '$remoteHost' as user '$remoteUser' using " -noNewline
|
||||||
& ssh -V
|
& ssh -V
|
||||||
if ($lastExitCode -ne "0") { throw "'ssh -V' failed with exit code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "'ssh -V' failed with exit code $lastExitCode" }
|
||||||
|
|
||||||
& ssh "$($username)@$($remoteHost)"
|
& ssh "$($remoteUser)@$($remoteHost)"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user