How to list the Cert Issuer for all servers in a Domain

Hello,

The objective is to list the Server name and Cert Issuer for any Cert found in the LocalMachine\My store on all servers in a Domain.

Once I'd get to a server, probably by PS remoting, I'd issue the following:

dir cert:\localmachine\my -recurse | ? Issuer -like '*'

However, the output is Thumbprint and Subject, but I really need to see the Issuer, or what is displayed in the Certificates MMC under the 'Issued By' column.  What I need in my output is the following:

ComputerName       Issuer

Srv1                       Acme Cert Auth

Srv2                       Host1.Acme.Com

Any suggestions would be appreciated.

March 24th, 2015 8:31pm

Hi,

Here's something you can try:

Get-Content .\computerList.txt | ForEach {

    $computerName = $_

    Invoke-Command -ComputerName $computerName -ScriptBlock {

        Set-Location Cert:\LocalMachine\My

        Get-ChildItem | 
            Select @{N='Computer';E={$env:COMPUTERNAME}},Issuer

    }

} | Select Computer,Issuer

Free Windows Admin Tool Kit Click here and download it now
March 24th, 2015 8:50pm

As you might suspect it is even easier than that:

$omputers |
    ForEach-Object{
        invoke-command -ComputerName $_ -ScriptBlock {dir cert:\localmachine\my -recurse}
    } |
    select PSComputerName, Issuer
March 24th, 2015 9:57pm

Both work great!

Thanks for the response and help Mike and Jrv!

Free Windows Admin Tool Kit Click here and download it now
March 24th, 2015 10:05pm

As you might suspect it is even easier than that:

$omputers |
    ForEach-Object{
        invoke-command -ComputerName $_ -ScriptBlock {dir cert:\localmachine\my -recurse}
    } |
    select PSComputerName, Issuer
March 24th, 2015 10:29pm

I wasn't really trying to do it differently but wanted to point out that PS decorates most things returned from a remote session.  It can make buiding object collections and reports much easier.

Consider that remoting will be the replacement for WMI with CIMOM.

Free Windows Admin Tool Kit Click here and download it now
March 24th, 2015 10:41pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics