Forum Discussion
Inventory SSL Root Cert Remotely Using PowerShell
I am not well versed with PowerShell but after researching it appears PowerShell might be the tool I need. I have a need to inventory all computers on my AD to confirm whether or not they have the necessary SSL root certs that I have attempted to push out via GPO.
Most computers do have the certs but I need to identify the ones that do not.
All examples I've run across seem to include "Path Cert :\localmachine". How do I replace 'localmachine' for 'computer name' to gather SSL cert info from remote computers on my LAN?
One example but it is not entirely clear how I would modify this script to connect remotely to each machine:
https://devblogs.microsoft.com/scripting/get-certificate-info-into-a-csv-by-using-powershell/
http://notesofascripter.com/2016/09/19/using-powershell-work-ssl-certificates/
8 Replies
"LocalMachine" is the name of the cert container, it will have the same value on all computers. You can either use Invoke-Command to run the cmdlet against each computer (example https://www.powershellbros.com/powershell-tip-of-the-week-get-certificate-remotely/) or use the built-in capabilities of the .NET method (example here: https://www.experts-exchange.com/questions/28623585/Need-to-get-certificates-inventory-for-each-server-into-the-spreadsheet-such-as-expiration-date-name-of-the-cert-issuer-cert-purpose.html)
- drawsonBrass Contributor
Thanks VasilMichev ,
I've been trying to get up to speed by reviewing the links you sent. I can manually add the list of computers to scan as I learn how to read a CSV. But my question now is how do I turn "LocalMachine" into reading the "Trusted Root Certificate Authorities\Certificates" for both 'Current User' & 'Local Computer'?
It's as simple as:
dir Cert:\CurrentUser\Root\ dir Cert:\LocalMachine\Root\