Comments on this page are supposed to improve article content and no technical support is provided. For technical questions, please visit project home page at: https://pspki.codeplex.com/

Get-CertificateContextProperty

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 can be found at:
http://pkix2.sysadmins.lv/library/html/T_System_Security_Cryptography_X509Certificates_X509CertificatePropertyType.htm

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 (http://go.microsoft.com/fwlink/?LinkID=113216).

Inputs

System.Security.Cryptography.X509Certificates.X509Certificate2

Outputs

System.Security.Cryptography.X509Certificates.X509CertificateContextProperty

Single certificate context property

System.Security.Cryptography.X509Certificates.X509CertificateContextPropertyCollection

A collection of all attached context properties

System.Security.Cryptography.X509Certificates.X509CertificatePropertyType

A collection of X509CertificatePropertyType enum values

Notes

Author: Vadims Podans
Blog: https://www.sysadmins.lv

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

PowerShell Support

  • PowerShell 3.0

Operating System Support

  • Windows Vista
  • Windows 7
  • Windows 8
  • Windows 8.1
  • Windows 10
  • Windows Server 2008 all editions
  • Windows Server 2008 R2 all editions
  • Windows Server 2012 all editions
  • Windows Server 2012 R2 all editions

Comments:

Captcha