For PowerShell on Windows 10.
When starting a new PowerShell terminal for the first time in a session, this function inits and loads an instance of the SSH Agent. On subsequent terminals, the script loads the info for the same instance previously created, so you don't have to input the passphrase on each window.
To persist the SSH Agent PID for the session, it uses the Volatile Environment registry key for the current logged in user. I'm not sure how safe this is, so don't use this script on a shared computer.
This script presumes the ssh-agent
command is available on your $env:PATH, otherwise you can add the full path to the executable on line 8.