Home ยป PowerShell ยป PowerShell Export Certificate from a Certificate Store

PowerShell Export Certificate from a Certificate Store

Use the Export-Certificate cmdlet in PowerShell to export a certificate or download a certificate from the certificate store. It takes the certificate store location path and certificate thumbprint as input to export a certificate in the Windows operating system.

Using the PowerShell script is an easy and quick way to export the certificate from the store to the .cer file. Another way to download the certificate is to use the mmc snap-in UI wizard.

In this article, we will discuss how to export the certificate from the certificate store using the PowerShell Export-Certificate command.

PowerShell Export Certificate

Use the Get-ChildItem command to retrieve the certificate details by its thumbprint and pass its output to the PowerShell Export-Certificate command to download the certificate.

Get-ChildItem Cert:\LocalMachine\My\95CC2B4A5A21404317D4C3C01276FBE08AA96546 | Export-Certificate -Type CERT -FilePath D:\Exported_HMITest.cer

In the above PowerShell script, the Get-ChildItem cmdlet gets the certificate details by thumbprint and passes the output to the PowerShell Export-Certificate command. It uses the Type parameter CERT and FilePath to download the certificate file to the location.

The output of the above PowerShell script exports the certificate from the store to the .cer file on the Windows OS drive as given below.

PowerShell Export Certificate to the .cer file
PowerShell Export Certificate to the .cer file

You can also export certificate to the other file formats like .P7B and .SST using the Export-Certificate command.

Conclusion

I hope the above article on how to export the certificate from the store to .cer file format using the PowerShell Export-Certificate command is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Recommended Article

How to create a self-signed certificate in PowerShell

How to bind a certificate to the IIS site

How to delete a self-signed certificate on the Windows operating system