I am looking for a way to query on issued certs from my CA based on their signing template. Here is what I start using (based on PSPKI 4.0.0 module);
$AllCerts= Get-CertificationAuthority -name CA_Authority | Get-IssuedRequest -Property Email,CertificateTemplate, CertificateTemplateOID
$RelevantInfo = ($AllCerts | ?{$_.CertificateTemplate -eq 'WebServer' -Or $_.CertificateTemplate -eq 'CustomTemplate'})
...however, the query isn't finding the 'CustomTemplate' matches. I even try using wildcard logic;
$RelevantInfo = ($AllCerts | ?{$_.CertificateTemplate -eq 'WebServer' -Or $_.CertificateTemplate -like '*CustomTemplateName*'})
I can see the values are there when I run;
Get-CertificateTemplate | Select Name, DisplayName, OID
But the query isn't finding matches for the 'CustomTemplateName'. Is there a way to actually get this 'friendly name' information for the issued certificates template?
For custom templates,
$row.CertificateTemplate
property contains template Object Identifier (OID), not name. Name is returned only for V1 templates (built-in and non-editable).So in your case, you have to get requested template OID first, then do filter: