From 8d659757cb3b284e2497792a2c50757b230a3718 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Mon, 14 Oct 2024 11:38:09 +0200 Subject: [PATCH] Renamed to enter-host.ps1 and wake-up-host.ps1 --- scripts/{enter.ps1 => enter-host.ps1} | 9 +++++---- scripts/{wake-up.ps1 => wake-up-host.ps1} | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) rename scripts/{enter.ps1 => enter-host.ps1} (76%) rename scripts/{wake-up.ps1 => wake-up-host.ps1} (97%) diff --git a/scripts/enter.ps1 b/scripts/enter-host.ps1 similarity index 76% rename from scripts/enter.ps1 rename to scripts/enter-host.ps1 index 9241dc07..c4dccebc 100755 --- a/scripts/enter.ps1 +++ b/scripts/enter-host.ps1 @@ -1,12 +1,14 @@ <# .SYNOPSIS - Login to another host via SSH + Enter another host via SSH .DESCRIPTION This PowerShell script logs into a remote host via secure shell (SSH). .PARAMETER remoteHost Specifies the remote hostname or IP address .EXAMPLE - PS> ./enter.ps1 linuxhost + PS> ./enter-host.ps1 tux + Entering 💻tux as user 'markus' using OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2 + ... .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -20,12 +22,11 @@ try { if ($IsLinux) { $username = $(whoami) } else { $username = $env:USERNAME } $username = $username.toLower() - Write-Host "Trying to enter 💻$remoteHost as user '$username' using " -noNewline + Write-Host "Entering 💻$remoteHost as user '$username' using " -noNewline & ssh -V if ($lastExitCode -ne "0") { throw "'ssh -V' failed with exit code $lastExitCode" } & ssh "$($username)@$($remoteHost)" - if ($lastExitCode -ne "0") { throw "'ssh -V' failed with exit code $lastExitCode" } exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/wake-up.ps1 b/scripts/wake-up-host.ps1 similarity index 97% rename from scripts/wake-up.ps1 rename to scripts/wake-up-host.ps1 index ba1d7bd8..27601f64 100755 --- a/scripts/wake-up.ps1 +++ b/scripts/wake-up-host.ps1 @@ -12,7 +12,7 @@ .PARAMETER numTimes Specifies # of times to send the packet (3 by default) .EXAMPLE - PS> ./wake-up.ps1 11:22:33:44:55:66 192.168.100.100 + PS> ./wake-up-host.ps1 11:22:33:44:55:66 192.168.100.100 ✅ Magic packet sent to IP 192.168.100.100, UDP port 9, 3x - wait a minute until the computer fully boots up. .LINK https://github.com/fleschutz/PowerShell