Export-KrCertificate
SYNOPSIS
Exports an X509Certificate2 to PFX or PEM(+key).
SYNTAX
__AllParameterSets
Export-KrCertificate [-Certificate] <X509Certificate2> [-FilePath] <string> [[-Format] <string>]
[[-Password] <securestring>] [-IncludePrivateKey] [<CommonParameters>]
ALIASES
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION
This function exports a given X509Certificate2 object to a specified file path in either PFX or PEM format. If the PEM format is chosen and the IncludePrivateKey switch is set, it will also export the private key.
EXAMPLES
EXAMPLE 1
Export-KrCertificate -Certificate $cert -FilePath ‘C:\certs\my’ ` -Format Pem -Password ‘p@ss’ -IncludePrivateKey
PARAMETERS
-Certificate
The X509Certificate2 object to export.
Type: System.Security.Cryptography.X509Certificates.X509Certificate2
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: true
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-FilePath
The file path to export the certificate to (without extension).
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Format
The export format (Pfx or Pem).
Type: System.String
DefaultValue: Pfx
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-IncludePrivateKey
Whether to include the private key in the export (only applicable for PEM format).
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Password
The password to protect the exported PFX file (if applicable).
Type: System.Security.SecureString
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 3
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
System.Security.Cryptography.X509Certificates.X509Certificate2
{{ Fill in the Description }}
OUTPUTS
NOTES
This function requires the Kestrun module to be imported.
RELATED LINKS
{{ Fill in the related links here }}