Get-PfxData

Get-PfxData

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

Syntax

Parameter Set: Default
Get-PfxData [-FilePath] <String> [-Password <SecureString> ] [ <CommonParameters>]

Detailed 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.

Parameters

-FilePath<String>

Specifies the path to the PFX file.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Password<SecureString>

Specifies the password for the imported PFX file.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • System.String

    A string containing the path to PFX file.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.CertificateServices.Commands.PFXData

    A PFXData object.

Examples

EXAMPLE 1

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

PS C:\> $mypwd = ConvertTo-SecureString -String "1234" -Force –AsPlainText
PS C:\> $mypfx = Get-PfxData –FilePath C:\mypfx.pfx –Password $mypwd

EXAMPLE 2

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

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

Export-PfxCertificate

ConvertTo-SecureString