Sample code for 30+ languages & platforms
VBScript

List Certificates in the Current User Certificate Store (Windows Only)

See more Certificates Examples

This is a Windows-only example to list the certificates in the current-user certificate store (located in the Windows Registry).

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

' This is a Windows-only example because it lists the certificates
' stored in the Windows Current User Certificate Store located in the
' Windows Registry.

set certStore = CreateObject("Chilkat.CertStore")

readOnly = 1
success = certStore.OpenCurrentUserStore(readOnly)
If (success = 0) Then
    outFile.WriteLine(certStore.LastErrorText)
    WScript.Quit
End If

set cert = CreateObject("Chilkat.Cert")
numCerts = certStore.NumCertificates
i = 0
Do While i < numCerts
    success = certStore.GetCert(i,cert)
    outFile.WriteLine("DN = " & cert.SubjectDN)
    outFile.WriteLine("Email = " & cert.SubjectE)
    i = i + 1
Loop

outFile.Close