Get-CertificateStore

Gets an X509CertificateStore object for the given location and store name.

Syntax

Get-CertificateStore -StoreLocation {CurrentUser | LocalMachine} -StoreName {AddressBook | AuthRoot | CertificateAuthority | Disallowed | My | Root | TrustedPeople | TrustedPublisher} [<CommonParameters>]

Get-CertificateStore -StoreLocation {CurrentUser | LocalMachine} -CustomStoreName <String> [<CommonParameters>]

Description

Returns an X509Store for a given store location and store name. The store must exist. Before being retured, it is opened for writing. If you don't have permission to write to the store, you'll get an error.

If you just want to read a store, we recommend using PowerShell's cert: drive.

Parameters

Name Type Description Required? Pipeline Input Default Value
StoreLocation StoreLocation

The location of the certificate store to get.

true false
StoreName StoreName

The name of the certificate store to get.

true false
CustomStoreName String

The name of the non-standard certificate store to get. Use this to pull certificates from a non-standard store.

true false

Return Values

Security.Cryptography.X509Certificates.X509Store.

EXAMPLE 1

Get-CertificateStore -StoreLocation LocalMachine -StoreName My

Get the local computer's Personal certificate store.

EXAMPLE 2

Get-CertificateStore -StoreLocation CurrentUser -StoreName Root

Get the current user's Trusted Root Certification Authorities certificate store.