< Back

Get-X509CertificateChain

Sat Jan 18, 2020 9:33 pm

NAME Get-X509CertificateChain



SYNOPSIS

Gets the certificate chain of the X509Certificate2 input.





SYNTAX

Get-X509CertificateChain [-Certificate] <X509Certificate2> [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The Get-X509CertificateChain cmdlet get the certificate chain of the X509Certificate2 input.





PARAMETERS

-Certificate <X509Certificate2>

Specifies the X509Certificate2 object type to retrieve certificate chain.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.Security.Cryptography.X509Certificates.X509Certificate2







OUTPUTS

System.Security.Cryptography.X509Certificates.X509Certificate2







NOTES





Author : Ryen Kia Zhi Tang



Blog : ryentang.wordpress.com (http://ryentang.wordpress.com/)



Example 1



PS C:\\> Get-X509Certificate -Uri live.com | Get-X509CertificateChain



Thumbprint Subject

---------- -------

454965D4125216F4303529C06292BE8D9B9AA3F8 CN=outlook.live.com

54D9D20239080C32316ED9FF980A48988F4ADF2D CN=Microsoft IT TLS CA 2, OU=Microsoft IT, O=Microsoft Corporation,

L=Redm...

D4DE20D05E66FC53FE1A50882C78DB2852CAE474 CN=Baltimore CyberTrust Root, OU=CyberTrust, O=Baltimore, C=IE



This command gets the certificate from live.com domain name and pipeline to Get-CertificateChain cmdlet to obtain

the certificate chain.

Example 2



PS C:\\> Get-X509Certificate -FilePath C:\\Temp\\live-com.cer | Get-X509CertificateChain



Thumbprint Subject

---------- -------

454965D4125216F4303529C06292BE8D9B9AA3F8 CN=outlook.live.com

54D9D20239080C32316ED9FF980A48988F4ADF2D CN=Microsoft IT TLS CA 2, OU=Microsoft IT, O=Microsoft Corporation,

L=Redm...

D4DE20D05E66FC53FE1A50882C78DB2852CAE474 CN=Baltimore CyberTrust Root, OU=CyberTrust, O=Baltimore, C=IE



This command gets the certificate from live-com.cer file using Get-CertificateChain cmdlet with FilePath parameter

to obtain the certificate chain.

Example 3



PS C:\\> Get-PfxCertificate -FilePath C:\\Temp\\live-com.cer | Get-X509CertificateChain



Thumbprint Subject

---------- -------

454965D4125216F4303529C06292BE8D9B9AA3F8 CN=outlook.live.com

54D9D20239080C32316ED9FF980A48988F4ADF2D CN=Microsoft IT TLS CA 2, OU=Microsoft IT, O=Microsoft Corporation,

L=Redm...

D4DE20D05E66FC53FE1A50882C78DB2852CAE474 CN=Baltimore CyberTrust Root, OU=CyberTrust, O=Baltimore, C=IE



This command gets the certificate from live-com.cer file and pipeline to Get-CertificateChain cmdlet to obtain the

certificate chain.

Example 4



PS C:\\> Get-X509CertificateChain -Certificate (Get-PfxCertificate -FilePath C:\\Temp\\live-com.cer)



Thumbprint Subject

---------- -------

454965D4125216F4303529C06292BE8D9B9AA3F8 CN=outlook.live.com

54D9D20239080C32316ED9FF980A48988F4ADF2D CN=Microsoft IT TLS CA 2, OU=Microsoft IT, O=Microsoft Corporation,

L=Redm...

D4DE20D05E66FC53FE1A50882C78DB2852CAE474 CN=Baltimore CyberTrust Root, OU=CyberTrust, O=Baltimore, C=IE



This command gets the certificate from live-com.cer file and pipeline to Get-CertificateChain cmdlet to obtain the

certificate chain.



RELATED LINKS

X509Chain Class https://docs.microsoft.com/en-gb/dotnet ... .x509chain

?view=netcore-2.0

X509ChainElement Class https://docs.microsoft.com/en-gb/dotnet ... ficates.x5

09chainelement?view=netcore-2.0