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?

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.

  • 1
    I dropped the -a and it seems to load fine. Thanks for the tip. – lonstar Oct 6 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.