mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-30 06:58:49 +02:00
Updated enter-host.ps1
This commit is contained in:
parent
e2c03310dd
commit
1186432bb0
@ -7,7 +7,7 @@
|
|||||||
Specifies the remote hostname or IP address
|
Specifies the remote hostname or IP address
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./enter-host.ps1 tux
|
PS> ./enter-host.ps1 tux
|
||||||
Entering 💻tux as user 'markus' using OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
|
💻 Entering 'tux' as user 'markus' using OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
|
||||||
...
|
...
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
@ -22,9 +22,10 @@ try {
|
|||||||
if ($IsLinux) { $username = $(whoami) } else { $username = $env:USERNAME }
|
if ($IsLinux) { $username = $(whoami) } else { $username = $env:USERNAME }
|
||||||
$username = $username.toLower()
|
$username = $username.toLower()
|
||||||
|
|
||||||
Write-Host "Entering 💻$remoteHost as user '$username' using " -noNewline
|
Write-Host "💻 Entering '$remoteHost' as user '$username' 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" }
|
||||||
|
Write-Host " (type 'exit' to leave $remoteHost)"
|
||||||
|
|
||||||
& ssh "$($username)@$($remoteHost)"
|
& ssh "$($username)@$($remoteHost)"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
Loading…
x
Reference in New Issue
Block a user