I have a client side cert PFX from some idiot to allow some users access his website and I need to script it so I can allow multiple users to auto import this cert into the local store during a logon to our RDS environment.
This cert also came with a long complicated password that I need to pass to said function.
So I had the bright idea of using PS function Import-PFXCertificate
to do this.
$PlainTextPass = "f4@)]\as1"
$pfxpass = $PlainTextPass |ConvertTo-SecureString -AsPlainText -Force
Import-PfxCertificate -filepath C:\important.pfx cert:\CurrentUser\my -
Password $pfxpass
It fails with this error, and I can't find any direct reference to it on the web.
Import-PfxCertificate : The PFX file you are trying to import requires either a different password or membership in an Active Directory principal to which it is protected.
The test user I am running against is a domain admin. Not that should matter as it's installing the cert into CurrentUser
Try surrounding the plain text password with single quotes instead of double quotes. I had a password with $ in it that gave me the same error until I swapped the quotes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With