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>]

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 certificate store location to get. true false
StoreName StoreName The certificate store name to get. true false

Return Values

System.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.