PowerShell - Get Certificate Details from list of servers.txt
- Jon Boyette
- Jan 10, 2022
- 1 min read
Save as a named .ps1, populate c:\temp\servers.txt with servers to gather detailed certificate info on
$a = Get-Content C:\temp\servers.txt
Invoke-Command -ComputerName $a -Scriptblock{
Get-ChildItem Cert:\LocalMachine\root | Where-Object {$_ -is [System.Security.Cryptography.X509Certificates.X509Certificate2] -and $_.NotAfter -lt (Get-Date)} | Select-Object -Property PSComputerName,FriendlyName,Subject,NotBefore,NotAfter,Issuer,Thumbprint
} | Export-Csv "c:\temp\CertificatesFromListedServers.csv"
Comments