From 473539b9bf9db7641d14a5a97138b3c6b3d1820b Mon Sep 17 00:00:00 2001 From: manojampalam Date: Sun, 3 Apr 2016 21:06:52 -0700 Subject: [PATCH] install and unintall scripts for sshd --- contrib/win32/openssh/install-sshd.ps1 | 17 +++++++++++++++++ contrib/win32/openssh/uninstall-sshd.ps1 | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 contrib/win32/openssh/install-sshd.ps1 create mode 100644 contrib/win32/openssh/uninstall-sshd.ps1 diff --git a/contrib/win32/openssh/install-sshd.ps1 b/contrib/win32/openssh/install-sshd.ps1 new file mode 100644 index 0000000..608a936 --- /dev/null +++ b/contrib/win32/openssh/install-sshd.ps1 @@ -0,0 +1,17 @@ +$scriptpath = $MyInvocation.MyCommand.Path +$scriptdir = Split-Path $scriptpath + +$sshdpath = Join-Path $scriptdir "sshd.exe" + +if (-not (Test-Path $sshdpath)) { + throw "sshd.exe is not present in script path" +} + +if (Get-Service sshd -ErrorAction SilentlyContinue) +{ + Stop-Service sshd + sc.exe delete sshd 1> null +} + +New-Service -Name sshd -BinaryPathName $sshdpath -Description "SSH Deamon" -StartupType Manual | Out-Null +Write-Host -ForegroundColor Green "sshd successfully installed" diff --git a/contrib/win32/openssh/uninstall-sshd.ps1 b/contrib/win32/openssh/uninstall-sshd.ps1 new file mode 100644 index 0000000..bd10780 --- /dev/null +++ b/contrib/win32/openssh/uninstall-sshd.ps1 @@ -0,0 +1,10 @@ +if (Get-Service sshd -ErrorAction SilentlyContinue) +{ + Stop-Service sshd + sc.exe delete sshd 1> null + Write-Host -ForegroundColor Green "sshd successfully uninstalled" +} +else { + Write-Host -ForegroundColor Yellow "sshd service is not installed" +} +