#powershell #ps1 #openssh #ssh #sshserver #ansible ``` # Check if OpenSSH Server is already installed $sshServerInstalled = Get-WindowsCapability -Online | Where-Object { $_.Name -eq 'OpenSSH.Server~~~~0.0.1.0' -and $_.State -eq 'Installed' } if (-not $sshServerInstalled) { # Install OpenSSH Server Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 # Configure SSH Server to start automatically Set-Service -Name sshd -StartupType 'Automatic' # Start SSH Server Start-Service -Name sshd # Optionally configure SSH Agent to start automatically Set-Service -Name ssh-agent -StartupType 'Automatic' Start-Service -Name ssh-agent # Configure Firewall New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 } else { Write-Output "OpenSSH Server is already installed." } # Verify SSH Server is running Get-Service -Name sshd ``` Zie ook [[ANSIBLE]] Zie ook [[WinRM, PSRemoting]]