bootstrap/bootstrap-Windows.ps1
Kenneth Benzie (Benie) 6fc342bc1b Update Windows bootstrap scripts
* Add `bootstrap-Windows.ps1` sets up the bare minimum required to start
  Debian in WSL2 sharing SSH keys with the Windows host and enable SSH
  server for remote access.
* Add `bootstrap-Windows.sh` copies Windows host SSH keys, upgrades
  Debian to unstable, then installs Ansible and dependencies.
* Remove `bootstrap-Windows.cmd`.
2022-06-11 12:52:52 +01:00

24 lines
1023 B
PowerShell

# Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# Enable Hyper-V and containters
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Enable-WindowsOptionalFeature -Online -FeatureName Containers -All
# Install OpenSSH and start service
choco install "--package-parameters=/SSHServerFeature" openssh
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
# generate keys and authorize them
# TODO: Ask for email address to use, make sshKeyType optional
$sshKeyType = "ed25519"
ssh-keygen -t "$sshKeyType" -C "benie@infektor.net" -N '' -f "$env:USERPROFILE/.ssh/$sshKeyType"
# TODO: authorize public key for admin
# Install Windows-Terminal and Debian
choco install microsoft-windows-terminal
wsl --install --distribution Debia
Restart-Computer