Updated enable-ssh-client.ps1 and enable-ssh-server.ps1

This commit is contained in:
Markus Fleschutz 2021-08-02 20:52:46 +02:00
parent d069b83cad
commit 8de3b7f559
2 changed files with 8 additions and 2 deletions

View File

@ -14,9 +14,12 @@
#Requires -RunAsAdministrator #Requires -RunAsAdministrator
try { try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
Add-WindowsCapability -Online -Name OpenSSH.Client* Add-WindowsCapability -Online -Name OpenSSH.Client*
write-host -foregroundColor green "OK - SSH client enabled" [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ enabled SSH client in $Elapsed sec"
exit 0 exit 0
} catch { } catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -14,11 +14,14 @@
#Requires -RunAsAdministrator #Requires -RunAsAdministrator
try { try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
Add-WindowsCapability -Online -Name OpenSSH.Server* Add-WindowsCapability -Online -Name OpenSSH.Server*
Start-Service sshd Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic' Set-Service -Name sshd -StartupType 'Automatic'
write-host -foregroundColor green "OK - SSH server enabled" [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ installed SSH server in $Elapsed sec"
exit 0 exit 0
} catch { } catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"