Counting the number of installed certificates via PowerShell

Don't ask why I needed to know this!

Bit of a random one, but should you ever need to count the number of certificates that are installed on a Windows Machine in the "Local Machine" store, here's a short PowerShell snippet that'll do the job:

Set-Location Cert:\LocalMachine

(Get-ChildItem -Recurse | ? { $_ -is [System.Security.Cryptography.X509Certificates.X509Certificate2] }).Count

The first line can, of-course be changed to "Cert:\CurrentUser" as another location in the PowerShell Cert: "drive", and then you can issue the command against the current users certificate store instead of the local machine scertificate store.

Please don't ask me why I needed to know this!

About Rob

I've been interested in computing since the day my Dad purchased his first business PC (an Amstrad PC 1640 for anyone interested) which introduced me to MS-DOS batch programming and BASIC.

My skillset has matured somewhat since then, which you'll probably see from the posts here. You can read a bit more about me on the about page of the site, or check out some of the other posts on my areas of interest.

No Comments

Add a Comment