mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-24 14:35:35 +02:00
install and unintall scripts for sshd
This commit is contained in:
parent
8c4d3f23ab
commit
473539b9bf
17
contrib/win32/openssh/install-sshd.ps1
Normal file
17
contrib/win32/openssh/install-sshd.ps1
Normal file
@ -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"
|
10
contrib/win32/openssh/uninstall-sshd.ps1
Normal file
10
contrib/win32/openssh/uninstall-sshd.ps1
Normal file
@ -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"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user