Get-Pfx Data

Extracts the content of a Personal Information Exchange (PFX) file into a structure without importing it to certificate store.

Syntax

Get-PfxData
   [-Password <SecureString>]
   [-FilePath] <String>
   [<CommonParameters>]

Description

The Get-PfxData cmdlet extracts the content of a Personal Information Exchange (PFX) file into a structure that contains the end entity certificate, any intermediate and root certificates.

Examples

EXAMPLE 1

PS C:\>$mypwd = ConvertTo-SecureString -String "1234" -Force -AsPlainText



PS C:\>$mypfx = Get-PfxData -FilePath C:\mypfx.pfx -Password $mypwd

This example returns certificate information for the file mypfx.pfx located on the C: drive that is secured with the specified password.

EXAMPLE 2

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:\mypfx.pfx -Password $NewPwd -Force

This example shows how one can change an existing password for mypfx.pfx file from $OldPwd to $NewPwd.

Required Parameters

-FilePath

Specifies the path to the PFX file.

Type: String
Aliases: FullName
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

Optional Parameters

-Password

Specifies the password for the imported PFX file.

Type: SecureString
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Inputs

System.String

A string containing the path to PFX file.

Outputs

Microsoft.CertificateServices.Commands.PFXData

A PFXData object.