Sample code for 30+ languages & platforms
PowerShell

Find a Certificate in the "Other People" Windows Certificate Store

See more Certificates Examples

Demonstrates how to open the "Current User --> Other People" Windows certificate store, and locates a certificate matching an email address.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$certStore = New-Object Chilkat.CertStore

# The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
$readOnly = $true
$success = $certStore.OpenWindowsStore("CurrentUser","AddressBook",$readOnly)
if ($success -ne $true) {
    $($certStore.LastErrorText)
    exit
}

# Find the certificate for the email address:
$jsonE = New-Object Chilkat.JsonObject
$jsonE.UpdateString("email","joe@example.com")

$cert = New-Object Chilkat.Cert
$success = $certStore.FindCert($jsonE,$cert)
if ($success -eq $false) {
    $($certStore.LastErrorText)
    exit
}

$("Found certificate: " + $cert.SubjectDN)