#http://woshub.com/using-ssh-key-based-authentication-on-windows/
$sshd_config                    = "C:\ProgramData\ssh\sshd_config"
#Get-Content -path $sshd_config | Select-String "Authentication";
#Get-Content -path $sshd_config | Select-String "StrictModes";
#Get-Content -path $sshd_config | Select-String "PasswordAuthentication";
#Get-Content -path $sshd_config | Select-String "AllowTcpForwarding";
((Get-Content -path $sshd_config -Raw) -replace '#PubkeyAuthentication yes'  ,'PubkeyAuthentication yes'  ) | Set-Content -Path $sshd_config
((Get-Content -path $sshd_config -Raw) -replace '#StrictModes yes'           ,'StrictModes no'            ) | Set-Content -Path $sshd_config
((Get-Content -path $sshd_config -Raw) -replace '#PasswordAuthentication yes','PasswordAuthentication no' ) | Set-Content -Path $sshd_config
((Get-Content -path $sshd_config -Raw) -replace '#AllowTcpForwarding yes'    ,'AllowTcpForwarding yes'    ) | Set-Content -Path $sshd_config
Restart-Service -Force sshd
sleep 5
