Greetings folks -
I'd like someone to help me craft a PowerShell script to obtain the thumbprint of a certificate issued with a specific template name on a server running Windows Server 2008 R2. Either using the certificate name or the EKU string for Server Authentication (188.8.131.52.184.108.40.206.1) would be sufficient.
My problem is that I've figured out how to do this very easily on Server 2012 R2 because Microsoft has added providers into PowerShell. It's as simple as running:
Get-ChildItem -Path Cert:\LocalMachine\My -SSLServerAuthentication | Sort-Object -Property NotAfter | Select-Object -Last 1 -ExpandProperty Thumbprint
However, the -SSLServerAuthentication property and the -EKU property that you could specify the usage string (1.3.6.xxx) on, do not exist on Server 2008 R2.
So... what I know is that I have a template named "PKI-Server Authentication". I know that each of my servers will have ONE certificate issued with this autoenrollment template.
What I'd like to do is find the thumbprint of the certificate that was issued with that template. As the template's name is part of the cert, I would think this is possible via PowerShell - somehow.
Please advise. Thank you in advance.