Get-PfxCertificate

Gets information about .pfx certificate files on the computer.

语法

ByPath (默认值)

Get-PfxCertificate
    [-FilePath] <String[]>
    [<CommonParameters>]

ByLiteralPath

Get-PfxCertificate
    -LiteralPath <String[]>
    [<CommonParameters>]

说明

The Get-PfxCertificate cmdlet gets an object representing each specified .pfx certificate file. A .pfx file includes both the certificate and a private key.

示例

Example 1: Get a .pfx certificate

PS C:\> Get-PfxCertificate -FilePath "C:\windows\system32\Test.pfx"
Password: ******
Signer Certificate:      David Chew (Self Certificate)
Time Certificate:
Time Stamp:
Path:                    C:\windows\system32\zap.pfx

This command gets information about the Test.pfx certificate on the system.

Example 2: Get a .pfx certificate from a remote computer

PS C:\> Invoke-Command -ComputerName "Server01" -ScriptBlock {Get-PfxCertificate -FilePath "C:\Text\TestNoPassword.pfx}" -authentication CredSSP

This command gets a .pfx certificate file from the Server01 remote computer. It uses Invoke-Command to run a Get-PfxCertificate command remotely.

When the .pfx certificate file is not password-protected, the value of the Authentication parameter of Invoke-Command must be CredSSP.

参数

-FilePath

Specifies the full path to the .pfx file of the secured file. If you specify a value for this parameter, it is not necessary to type -FilePath at the command line.

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False

参数集

ByPath
Position:0
必需:True
来自管道的值:True
来自管道的值(按属性名称):True
来自剩余参数的值:False

-LiteralPath

The full path to the .pfx file of the secured file. Unlike FilePath, the value of the LiteralPath parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False
别名:PSPath

参数集

ByLiteralPath
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

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.

输入

String

You can pipe a string that contains a file path to Get-PfxCertificate.

输出

X509Certificate2

Get-PfxCertificate returns an object for each certificate that it gets.

备注

  • When using the Invoke-Command cmdlet to run a Get-PfxCertificate command remotely, and the .pfx certificate file is not password protected, the value of the Authentication parameter of Invoke-Command must be CredSSP.