PowerShell PKI Module Documentation

Documentation Home

Get-CertificateContextProperty

Synopsis

Gets the certificate context property from Windows Certificate Store.

Syntax

Get-CertificateContextProperty -Certificate <X509Certificate2> [-PropertyName <X509CertificatePropertyType>] [<CommonParameters>]

Get-CertificateContextProperty -Certificate <X509Certificate2> [-NameList] [<CommonParameters>]

Description

Gets the certificate context property from Windows Certificate Store or serialized store (SST). When the certificate is installed in the certificate store it is possible to attach some certificate properties which are not the part of the certificate. There are number of certificate context properties, like Friendly Name, Description, Private Key Information, enrollment information, Extended Validation (EV) policies, etc. The full list of supported properties is defined in X509CertificatePropertyType enumeration.

Parameters

-Certificate <X509Certificate2>

Specifies the certificate from Windows Certificate Store or serialized (SST) store.

Required? True
Position? named
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? False

-PropertyName <X509CertificatePropertyType>

Specifies the property name to return. By default, all attached properties are returned. This parameter is not compatible with '-NameList' parameter.

Note: If specific property is requested and it is not available for the specified certificate, an exception will be thrown.

Required? False
Position? named
Default value None
Accept pipeline input? false
Accept wildcard characters? False

-NameList <SwitchParameter>

Retrives the list of attached properties as a collection of property name. You can use this information to retrieve existing certificate property. This parameter is not compatible with '-PropertyName' parameter.

Required? False
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? False

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, InformationAction, InformationVariable,
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

SysadminsLV.PKI.Cryptography.X509Certificates.X509CertificateContextProperty

Single certificate context property


SysadminsLV.PKI.Cryptography.X509Certificates.X509CertificateContextPropertyCollection

A collection of all attached context properties


SysadminsLV.PKI.Cryptography.X509Certificates.X509CertificatePropertyType

A collection of X509CertificatePropertyType enum values

Notes

Examples

Example 1

PS C:\> (Get-ChildItem cert:\CurrentUser\my)[0] | Get-CertificateContextProperty -NameList

Retrieves the list of populated property names for the first certificate in the 'Current User\Personal' store.

Example 2

PS C:\> (Get-ChildItem cert:\CurrentUser\my)[0] | Get-CertificateContextProperty -PropertyName "ProviderInfo"

Retrieves the private key's cryptographic service provider. If presented, output information will contain CSP/KSP name, provider type and container name.

Example 3

PS C:\> (Get-ChildItem cert:\CurrentUser\my)[0] | Get-CertificateContextProperty

Retrieves all available certificate context properties and their values for the specified certificate object.

Related links

Minimum PowerShell version support

  • Windows PowerShell 3.0

Operating System Support

  • Windows 7
  • Windows 8
  • Windows 8.1
  • Windows 10
  • Windows 11
  • Windows Server 2008 R2 all editions
  • Windows Server 2012 all editions
  • Windows Server 2012 R2 all editions
  • Windows Server 2016 all editions
  • Windows Server 2019 all editions
  • Windows Server 2022 all editions