This is the built-in help made by Microsoft for the command 'Export-PfxCertificate', 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.
Exports a certificate or a PFXData object to a Personal Information Exchange (PFX) file.
Export-PfxCertificate [-Cert] <Certificate> [-FilePath] <String> [-ChainOption <ExportChainOption>] [-Force] [-NoClobber] [-NoProperties] [-Password <SecureString>]
[-ProtectTo <String>] [-Confirm] [-WhatIf] [<CommonParameters>]
Export-PfxCertificate [-PFXData] <PfxData> [-FilePath] <String> [-ChainOption <ExportChainOption>] [-Force] [-NoClobber] [-NoProperties] [-Password <SecureString>]
[-ProtectTo <String>] [-Confirm] [-WhatIf] [<CommonParameters>]
The Export-PfxCertificate cmdlet exports a certificate or a PFXData object to a Personal Information Exchange (PFX) file. By default, extended properties and the entire
chain are exported.
Delegation may be required when using this cmdlet with Windows PowerShell® remoting and changing user configuration.
<
Online Version: http://go.microsoft.com/fwlink/p/?linkid=287527
ConvertTo-SecureString
Get-ChildItem
Get-PfxData
Import-PfxCertificate
<
EXAMPLE 1
PS C:\>$mypwd = ConvertTo-SecureString -String "1234" -Force –AsPlainText
PS C:\>Get-ChildItem -Path cert:\localMachine\my\5F98EBBFE735CDDAE00E33E0FD69050EF9220254 | Export-PfxCertificate -FilePath C:\mypfx.pfx -Password $mypwd
This example exports a certificate from the local machine store to a PFX file which includes the entire chain and all external properties.
EXAMPLE 2
PS C:\>$mypwd = ConvertTo-SecureString -String "1234" -Force –AsPlainText
PS C:\>Get-ChildItem -Path cert:\LocalMachine\my | Export-PfxCertificate -FilePath C:\mypfx.pfx -Password $mypwd
This example exports all certificates under the My store for the machine account into one file named mypfx.pfx. In order for this cmdlet to succeed, all keys need to be
exportable.
EXAMPLE 3
PS C:\>$mypwd = ConvertTo-SecureString -String "1234" -Force –AsPlainText
PS C:\>Export-PfxCertificate –Cert cert:\currentuser\my\5F98EBBFE735CDDAE00E33E0FD69050EF9220254 –FilePath c:\myexport.pfx -ChainOption EndEntityCertOnly -NoProperties
-Password $mypwd
This example exports a certificate from the current user store with no chain and no external properties
EXAMPLE 4
PS C:\>$a = Get-ChildItem -Path cert:\localMachine\my
Export-PfxCertificate –Cert $a[1] –FilePath C:\myexport.pfx -ProtectTo "contoso\billb99, contoso\johnj99"
This example exports a certificate from the current machine store. Both user accounts, contos\billb99 and contos\johnj99, can access this PFX with no password. A Windows® 8
DC for key distribution is required.
EXAMPLE 5
PS C:\>$a = Get-ChildItem -Path cert:\localMachine\my
PS C:\>$mypwd = ConvertTo-SecureString -String "1234" -Force –AsPlainText
PS C:\>Export-PfxCertificate –Cert $a[1] –FilePath C:\myexport.pfx -ProtectTo "contoso\billb99, contoso\johnj99" -Password $mypwd
This example exports a certificate from the current machine store. Both user accounts, johnj99 and billb99, can access this PFX file with no password. For everyone else,
they need to use 1234 as a password. A Windows 8 DC for key distribution is required.
EXAMPLE 6
PS C:\>$NewPwd = ConvertTo-SecureString -String "abcd" -Force –AsPlainText
PS C:\>$mypfx = Get-PfxData –FilePath C:\mypfx.pfx -Password $Oldpwd
PS C:\>Export-PfxCertificate -PFXData $mypfx –FilePath C:\mypfx2.pfx -Password $NewPwd
This example changes an existing password for a PFX file from $OldPwd to $NewPwd.