Update Script.ps1
parent
56641f75e4
commit
ab693c7dbf
16
Script.ps1
16
Script.ps1
|
@ -44,3 +44,19 @@ powercfg -change -standby-timeout-ac 0
|
|||
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
|
||||
powercfg /hibernate on
|
||||
powercfg -change -monitor-timeout-ac 30
|
||||
|
||||
# Install OpenSSH
|
||||
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
|
||||
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
|
||||
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
|
||||
|
||||
Start-Service sshd
|
||||
|
||||
Set-Service -Name sshd -StartupType 'Automatic'
|
||||
|
||||
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
|
||||
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
|
||||
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
|
||||
} else {
|
||||
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
|
||||
}
|
Loading…
Reference in New Issue