Using inetmgr, I made a pfx file containing the public and private keys for a certificate. Now I'm trying to install the pfx into another machine from the command prompt with
certutil -p <password> -importpfx root <path_to_pfxfile>
Unfortunately, this is only importing the public key. If I use the certmgr snap-in I can import both keys, but I need to be able to automate this. Can anybody help?
Best Answer
The
Import-PfxCertificate
PowerShell command will probably do what you want. .This would import the certificate(s) and keys stored in
my.pfx
file into theTrusted Root Certificate Authorities
certificate store for the local machine.You may need to experiment a bit to find the name used for the certificate store of interest. I did this by copying the thumbprint of a certificate in the relevent store from the UI, removing spaces and then running
ls|where {$_.Thumbprint -eq "<thumprint value here, with spaces removed>"}
Which gave me this as part of the output.
Directory: Microsoft.PowerShell.Security\Certificate::LocalMachine\Root