How can I export a certificate from MMC as a PFX file?
The Certificates snap-in really doesn't like to export PFX certificates, but PowerShell is happy to. You can use the Export-PfxCertificate
cmdlet.
- Go to the certificates pseudo-drive by typing
cd cert:\
at the PowerShell prompt. - Type
cd CurrentUser
orcd LocalMachine
as appropriate for where the certificate is. You may need to launch PowerShell as admin to export a machine certificate. cd
into the appropriate store (adir
may help). The Personal store in MMC is calledMy
here.- Use
dir
to identify which ID corresponds to the certificate you want. Type this command to export it as a PFX with a password:
Export-PfxCertificate -Cert .\LONGSTRINGOFHEX -FilePath 'C:\path\to\outfile.pfx' -Password (ConvertTo-SecureString -String 'password' -AsPlainText -Force)
LONGSTRINGOFHEX
should be replaced with your certificate's ID. Fortunately, you can use tab completion on that.
Once that command executes, you have a PFX certificate protected with the password you supplied. PowerShell refuses to export the certificate's private key without a password, and the password can't be blank. Nevertheless, your PFX is out.