Loading SSH keys into pageant

So, this is where I start posting stuff… here’s a reminder to myself about how to load a bunch of private keys into Pageant when windows starts, because just dropping the .ppk files into the startup folder seems to have a 50/50 chance of spawning multiple instances of Pageant which of course breaks everything. The alternative of specifying each key separately in a shortcut becomes unweildy very quickly - even three keys starts to be hard to manage.

The powershell magic

So all this does is list the ppk files in the current directory and grab their full name. Then the array of names is passed to the commandline for Pageant. Not really all that magic…

& 'C:\Program Files (x86)\PuTTY\pageant.exe' (gci *.ppk | ForEach-Object { $_.FullName })

Making it happen at startup

Put a shortcut in the startup folder that launches the powershell with the one-liner from earlier:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy bypass -Command "& 'C:\Program Files (x86)\PuTTY\pageant.exe' (gci *.ppk | ForEach-Object { $_.FullName })"

Set the target directory to the directory containing all your keys, and maybe make it start minimized so you don’t have a command window pop up while you’re booting.