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
try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
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
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -14,11 +14,14 @@
#Requires -RunAsAdministrator
try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
Add-WindowsCapability -Online -Name OpenSSH.Server*
Start-Service sshd
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
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"