Install a pfx certificate on a remote server with powershell Install a pfx certificate on a remote server with powershell powershell powershell

Install a pfx certificate on a remote server with powershell


The Cmdlet Import-PfxCertificate is part of the module PKIClient.

The PKI Client Cmdlets in Windows PowerShell are only available on

  • Windows 8.1
  • Windows PowerShell 4.0
  • Windows Server 2012 R2

Try to load the PKI Client in your Script:

Invoke-command -ComputerName myservername -scriptblock {     Get-Command -Module PKIClient;     Import-PfxCertificate –FilePath D:\pfxcert.pfx cert:\localMachine\my -Password (ConvertTo-SecureString -String "mypassword" -Force –AsPlainText) }

You could try Get-Command -Module PKIClient to see all cmdlets.


The Import-PfxCertificate cmdlet does not exist on the target machine. Probably because it is running a version of Powershell less than 3.

You'll have to install a newer version of PowerShell if possible, or find a different method of importing the certificate.


Well, if you need to call it from C# anyway, then it will be probably worth to install it from C#, like

using System.Security.Cryptography.X509Certificates;X509Certificate2 certificate = new X509Certificate2("C:\TEMP\yourcerthere.pfx", "yourpasswordhere");X509Store store = new X509Store(StoreName.TrustedPublisher, StoreLocation.LocalMachine);store.Open(OpenFlags.ReadWrite);store.Add(certificate);store.Close();

It will be approx the same code in powershell actually, since it's no other way but use .net system class or some tool like this.