update ssh script
-##Check if openssh is installed
-if((Get-WindowsCapability -Online | ? Name -like OpenSSH*).State -eq "Installed")
- {
- Write-Output "OpenSSH Server is installed."
- }
-
-else
-
- {
- Write-Output "OpenSSH Server is NOT installed.";
- ## Install SSH
- Add-WindowsCapability -Online -Name "OpenSSH.Server~~~~0.0.1.0"
-
- ## Set SSH service to start automatically
- Set-Service -Name sshd -StartupType "Automatic"
-
- ## Allow SSH through firewall on all profiles
- Get-NetFirewallRule -Name *ssh*
-
- ## Start SSH service
+if((Get-WindowsCapability -Online | ? Name -like OpenSSH.Server*).State -eq "Installed") {
+ Write-Output "OpenSSH Server is already installed."
+} else {
+ Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
+ Set-Service -Name sshd -StartupType 'Automatic'
Start-Service sshd
-
}
+Get-WindowsCapability -Online | Where-Object -Property Name -Like "OpenSSH*"
