Skip to content

Instantly share code, notes, and snippets.

@chunter
Created June 20, 2017 10:51
Show Gist options
  • Select an option

  • Save chunter/3ec25dd802c2163265eacfcb6f53cb7d to your computer and use it in GitHub Desktop.

Select an option

Save chunter/3ec25dd802c2163265eacfcb6f53cb7d to your computer and use it in GitHub Desktop.
Make Pageant autoload keys at startup
To make Pageant automatically run and load keys at startup:
- Find the location of pageant.exe
- Windows key + R to open the 'run' dialog box
- Type: 'shell:startup' in the dialog box
- Create a shortcut to the pageant.exe and put into this startup folder.
- Right click on the shortcut and open 'Properties'
- In 'Target' add: "<route to>/pageant.exe" myprivatekeyname.ppk
- In 'Start in' add: "<route to myprivatekeyname.ppk>"
- Click on the shortcut link and check that Pageant has started and has loaded your keys
@Voljka1
Copy link
Copy Markdown

Voljka1 commented Apr 9, 2026

  1. Save load_keys.ps1 in your user's profile ssh folder:

start code

if (-not (Get-Process pageant -ErrorAction SilentlyContinue)) {
$keys = Get-ChildItem "$env:USERPROFILE.ssh*.ppk" | ForEach-Object FullName
if ($keys) {
Start-Process "C:\Program Files\PuTTY\pageant.exe" `
-ArgumentList (@("--encrypted") + $keys)
}
}

end code

  1. Run -> shell:startup
    Create shortcut in opened window:
    Target: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%USERPROFILE%.ssh\load_keys.ps1"
    Start in: %USERPROFILE%.ssh
    Run: minimized

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment