mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-08 00:54:04 +01:00
Add enable-ssh-server.ps1
This commit is contained in:
parent
8f59a7fd0f
commit
565c45febe
@ -34,6 +34,7 @@ display-time.ps1, displays the current time for 10 seconds by default
|
||||
download.ps1, downloads the file/directory from the given URL
|
||||
enable-crash-dumps.ps1, enables the writing of crash dumps
|
||||
enable-god-mode.ps1, enables the god mode (adds a new icon to the desktop)
|
||||
enable-ssh-server.ps1, enables the SSH server
|
||||
encrypt-file.ps1, encrypts the given file
|
||||
fetch-repo.ps1, fetches updates for the current/given Git repository (including submodules)
|
||||
fetch-repos.ps1, fetches updates for all Git repositories under the current/given directory (including submodules)
|
||||
|
|
@ -37,6 +37,7 @@ Mega Collection of PowerShell Scripts
|
||||
* [check-swap-space.ps1](Scripts/check-swap-space.ps1) - checks the swap space for free space left
|
||||
* [check-windows-system-files.ps1](Scripts/check-windows-system-files.ps1) - checks the validity of the Windows system files (requires admin rights)
|
||||
* [enable-crash-dumps.ps1](Scripts/enable-crash-dumps.ps1) - enables the writing of crash dumps
|
||||
* [enable-ssh-server.ps1](Scripts/enable-ssh-server.ps1) - enables the SSH server
|
||||
* [hibernate.ps1](Scripts/hibernate.ps1) - enables hibernate mode for the local computer (requires admin rights)
|
||||
* [list-drives.ps1](Scripts/list-drives.ps1) - lists all drives
|
||||
* [list-network-shares.ps1](Scripts/list-network-shares.ps1) - lists the network shares of the local computer
|
||||
|
19
Scripts/enable-ssh-server.ps1
Executable file
19
Scripts/enable-ssh-server.ps1
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./enable-ssh-server.ps1
|
||||
.DESCRIPTION enables the SSH server
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
Add-WindowsCapability -Online -Name OpenSSH.Server*
|
||||
Start-Service sshd
|
||||
Set-Service -Name sshd -StartupType 'Automatic'
|
||||
|
||||
write-host -foregroundColor green "OK - SSH server enabled"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user