File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ $scriptpath = $MyInvocation.MyCommand.Path
2
+ $scriptdir = Split-Path $scriptpath
3
+
4
+ $sshdpath = Join-Path $scriptdir " sshd.exe"
5
+
6
+ if (-not (Test-Path $sshdpath )) {
7
+ throw " sshd.exe is not present in script path"
8
+ }
9
+
10
+ if (Get-Service sshd - ErrorAction SilentlyContinue)
11
+ {
12
+ Stop-Service sshd
13
+ sc.exe delete sshd 1> null
14
+ }
15
+
16
+ New-Service - Name sshd - BinaryPathName $sshdpath - Description " SSH Deamon" - StartupType Manual | Out-Null
17
+ Write-Host - ForegroundColor Green " sshd successfully installed"
Original file line number Diff line number Diff line change
1
+ if (Get-Service sshd - ErrorAction SilentlyContinue)
2
+ {
3
+ Stop-Service sshd
4
+ sc.exe delete sshd 1> null
5
+ Write-Host - ForegroundColor Green " sshd successfully uninstalled"
6
+ }
7
+ else {
8
+ Write-Host - ForegroundColor Yellow " sshd service is not installed"
9
+ }
10
+
You can’t perform that action at this time.
0 commit comments