< Back
Export-Certificate
Post
NAME Export-Certificate
SYNOPSIS
Exports a certificate from a certificate store into a file.
SYNTAX
Export-Certificate [-Force] [-NoClobber] [-Type {SST | CERT | P7B}] -Cert <Certificate> -FilePath <String> [-Confirm] [-WhatIf] [<CommonParameters>]
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.
PARAMETERS
-Cert <Certificate>
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.
Required? true
Position? named
Default value none
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-FilePath <String>
Specifies the location where the exported certificate will be stored.
Required? true
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
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.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
System.Security.Cryptography.X509Certificates.X509Certificate2
A Certificate object can be piped into to this cmdlet.
OUTPUTS
System.IO.FileInfo
The FileInfo object contains the information about the certificate file.
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.
RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/p/?linkid=287526
Get-ChildItem
Import-Certificate
SYNOPSIS
Exports a certificate from a certificate store into a file.
SYNTAX
Export-Certificate [-Force] [-NoClobber] [-Type {SST | CERT | P7B}] -Cert <Certificate> -FilePath <String> [-Confirm] [-WhatIf] [<CommonParameters>]
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.
PARAMETERS
-Cert <Certificate>
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.
Required? true
Position? named
Default value none
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-FilePath <String>
Specifies the location where the exported certificate will be stored.
Required? true
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
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.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
System.Security.Cryptography.X509Certificates.X509Certificate2
A Certificate object can be piped into to this cmdlet.
OUTPUTS
System.IO.FileInfo
The FileInfo object contains the information about the certificate file.
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.
RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/p/?linkid=287526
Get-ChildItem
Import-Certificate