Manage Windows Using Ansible

Setup openssh (prerequisites) Before using ansible to manage windows, make sure that openssh is installed and enabled. If not, you can use this powershell script to do so: $sshServer = Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Server*' if ($sshServer.State -ne 'Installed') { Write-Host "Installing OpenSSH Server..." Add-WindowsCapability -Online -Name $sshServer.Name } else { Write-Host "OpenSSH Server is already installed." } # Set default shell to powershell for ansible if (-not (Get-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -ErrorAction SilentlyContinue)) { Write-Host "Set default shell to powershell....

November 20, 2024 · 2 min