Search multiple servers in powershell to find if it has a certificate thumbprint

Ak 1 Reputation point
2022-10-16T14:22:44.07+00:00

I am looking for a script to query a list of servers to find which ones have a specific certificate (Using the thumbprint)

1 - Input is a list of servers in a txt file
2 - Query loops through the list of servers
3 - returns the servers that has the certificate in a text file

Windows for business Windows Server User experience PowerShell
Windows for business Windows Server Devices and deployment Configure application groups
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2022-10-17T01:49:57.75+00:00

    Try something like this:

    $Thumbprint = '838A1C18C19XXBOGUSXX47CC21071A0F220617466'  
    $cn = Get-ADComputer -Filter * | Select-Object -ExpandProperty Name  
    Invoke-Command -ComputerName $cn -ScriptBlock{  
        Get-ChildItem -path Cert:\* -Recurse |  
            Where-Object $_.Thumbprint -eq $Using.$ThumbPrint |  
                Select-Object @{n='Computer';e={$ENV:ComputerName}}, Thumbprint, Friendlyname  
    }  
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.