Hi, I don't see the file attached anywhere. You could create a foreach loop that will pass through each template name and call your script using the template name. Here is a sample pseudo-code:
# Get all PKI template names
$TemplateNames = Get-ADObject -Filter 'objectClass -eq "pKICertificateTemplate"' -SearchBase "CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=domain,DC=com" | Select-Object -ExpandProperty Name
foreach($temp in $TemplateNames)
{
.\Your-script.ps1 -TemplateName $temp
}
Good luck! Marius ENE - https://mariusene.com/