Export-Certificate
Export-Certificate [-Force] [-NoClobber] [-Type {SST | CERT | P7B}] -Cert* <Certificate> -FilePath* <String>[-Confirm] [-WhatIf] [<CommonParameters>]
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.
Parameters
-Cert <Certificate>
- This value is required
- Accepts pipeline input ByValue
Specifies one or more certificates to be exported to a file. A single certificate object, an array of certificate objects, or a path to one or more certificates in a certificate store can be specified.
-FilePath <String>
- This value is required
Specifies the location where the exported certificate will be stored.
-Force [<SwitchParameter>]
Specifies that the exported certificate file will overwrite an existing certificate file, unless the Read-only or hidden attribute is set or the NoClobber parameter is also used. The NoClobber parameter takes precedence over this parameter when both are used.
-NoClobber [<SwitchParameter>]
Prevents an exported certificate file from overwriting an existing certificate file. This parameter takes precedence over the Force parameter, which permits this cmdlet to overwrite an existing certificate file, even if it has the Read-only attribute set.
-Type [<CertType>]
Specifies the type of output file for the certificate export as follows.
-- SST: A Microsoft serialized certificate store (.sst) file format which can contain one or more certificates. This is the default value for multiple certificates.
-- CERT: A .cer file format which contains a single DER-encoded certificate. This is the default value for one certificate.
-- P7B: A PKCS#7 file format which can contain one or more certificates.
-Confirm [<SwitchParameter>]
- Default value is false
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
-WhatIf [<SwitchParameter>]
- Default value is false
Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.
Inputs
System.Security.Cryptography.X509Certificates.X509Certificate2Outputs
System.IO.FileInfoThis work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.
PowerShell Commands