This post is an accompanying post for the VM Setup video that is part of the PowerShell Collaboration Unleashed series.
Check if OpenSSH Client is installed
Get-WindowsCapability -Online | Where-Object{ $_.Name -like 'OpenSSH.Client*' }
Install SSH Windows 10/11
Get-WindowsCapability -Online | Where-Object{ $_.Name -like 'OpenSSH.Client*' } |
ForEach-Object{ Add-WindowsCapability -Online -Name $_.Name }
Enable SSH Agent
Get-Service -Name ssh-agent | Set-Service -StartupType Automatic
Start the SSH Agent
Start-Service ssh-agent
Generate SSH key pair
ssh-keygen
Add key to the SSH Agent
ssh-add "$($env:USERPROFILE)\.ssh\tljh"
Copy public key to remote server
type "$($env:USERPROFILE)\.ssh\tljh.pub" | ssh [email protected] "mkdir -p
~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >>
~/.ssh/authorized_keys"