1

I'm using Pageant 0.70 to load keys on Windows 10 via a PowerShell script:

profile-file.ps1

$pageant-path = "c:\full-path-to-pageant.exe"
$keypath1 = c:\full-path-to-key1
$keypath2 = c:\full-path-to-key2
$keypath3 = c:\full-path-to-key3

init.ps1

# sourcing from profile
. profile-file.ps1

# load keys - doing this because keys are in different locations and paths are too long to have in one spot
& $pageantpath -a "$keypath1"
& $pageantpath -a "$keypath2"
& $pageantpath -a "$keypath3"

When the Pageant commands in init.ps1 run, for each one I get the error popup

couldn't open this key (unable to open file")

But when I check Pageant after clearing the popups, the keys are all successfully loaded in Pageant and I can use them.

I've tried

  1. Wrapping key in quotes
  2. Using the -c flag on Pageant to run a command
  3. Running from command line
  4. Using/not using -a Pageant command line switch

So far, all of these are having the same result - I get error popups but the keys load. Any other approaches I can use to prevent these error popups?

lonstar
  • 234

1 Answers1

2
c:\full-path-to-pageant.exe -a c:\full-path-to-key1

Pageant does not have any -a switch. It takes the -a as a file name and tries to load it, failing. Hence the error message. Then it takes the next argument and successfully loads that key.