Reputation: 2301
I've got some pretty simple code I'm trying to troubleshoot. The environment is an Azure Windows Server 2012 machine, and I'm logged in as a domain admin running a Powershell console with Administrator privileges.
I'm just trying to Import-PFXCertificate from a known location but it will not accept the network password.
Here's the code.
$SecurePWD = ConvertTo-SecureString -String 'iW@nt2die' -AsPlainText -Force
Import-PFXCertificate -Password $SecurePWD -CertStoreLocation "Cert:\LocalMachine\Root" -FilePath "C:\Certs\TestCert.pfx"
When I run this beautiful block of code, with the password being absolutely correct (I tested by logging in using the password), it greets me with this error:
Import-PFXCertificate : The specified network password is not correct.
WHYYYY.
I've tried escaping out the @, but that doesn't do anything. I've tried crying, but the computer is completely unmoved by my tears.
Upvotes: 2
Views: 6755
Reputation: 11
I know this post is a little older, but as I saw that some people commented recently, i wanted to share our solution.
We had a similar problem when we tried to replace our SSL certificate by a new one.
We experienced the same error message but while using the method Get-PfxData
, not Import-Pfx
but I think it's the same issue.
The problem was that our new Pfx-Password contained a dollar sign $
which is reserved in Powershell to be variable. After escaping the dollar sign with a quote (`) it worked.
So if the password was XyZaBc$DeF we needed to use XyZaBc`$DeF.
That solved the problem in our case.
Upvotes: 1
Reputation: 2342
Per documentation for Import-PfxCertificate, the -Password
parameter is for the password of the certificate and not the user to login with.
-Password - Specifies the password for the imported PFX file in the form of a secure string.
Upvotes: 3