PowerShell Logo Small

Export-Certificate



This is the built-in help made by Microsoft for the command 'Export-Certificate', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Exports a certificate from a certificate store into a file.

SYNTAX


Export-Certificate [-Force] [-NoClobber] [-Type <CertType>] -Cert <Certificate> -FilePath <String> [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Export-Certificate cmdlet exports a certificate from a certificate store to a file. The private key is not included in the export. If more than one certificate is being
exported, then the default file format is SST. Otherwise, the default format is CERT. Use the Type parameter to change the file format.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=287526
Get-ChildItem
Import-Certificate

REMARKS

<

Examples


EXAMPLE 1

PS C:\>$cert = (Get-ChildItem -Path cert:\CurrentUser\My\EEDEF61D4FF6EDBAAD538BB08CCAADDC3EE28FF)



PS C:\>Export-Certificate -Cert $cert -FilePath c:\certs\user.sst -Type SST



This example exports a certificate to the file system as a Microsoft serialized certificate store without its private key.




EXAMPLE 2

PS C:\>$cert = (Get-ChildItem -Path cert:\CurrentUser\My\EEDEF61D4FF6EDBAAD538BB08CCAADDC3EE28FF)



PS C:\>Export-Certificate -Cert $cert -FilePath c:\certs\user.cer



This example exports a certificate to the file system as a DER-encoded .cer file without its private key.




EXAMPLE 3

PS C:\>$cert = ( Get-ChildItem -Path cert:\CurrentUser\My\EEDEF61D4FF6EDBAAD538BB08CCAADDC3EE28FF )



PS C:\>Export-Certificate -Cert $cert -FilePath c:\certs\user.p7b -Type p7b



This example exports a certificate to the file system as a PKCS#7-fomatted .p7b file without its private key.




EXAMPLE 4

PS C:\>Get-ChildItem -Path cert:\CurrentUser\my | Export-Certificate –FilePath c:\certs\allcerts.sst -Type SST



This example exports all certificates under CurrentUser\my store into a Microsoft serialized certificate store allcerts.sst.