Powershell 如何删除具有特定模板的证书?
我在Windows上有一些证书。这些证书有不同的模板 我可以得到指纹:Powershell 如何删除具有特定模板的证书?,powershell,certificate,Powershell,Certificate,我在Windows上有一些证书。这些证书有不同的模板 我可以得到指纹: $Certificates = get-childitem cert:\LocalMachine\My 我可以获得模板: $Template = ($Certificates.extensions | where-object{$_.oid.FriendlyName -match "Certificate Template Information"}).format(0) 因此,我想使用powershell根据指纹自动删
$Certificates = get-childitem cert:\LocalMachine\My
我可以获得模板:
$Template = ($Certificates.extensions | where-object{$_.oid.FriendlyName -match "Certificate Template Information"}).format(0)
因此,我想使用powershell根据指纹自动删除具有特定模板的证书。将其包装在
Where Object
过滤器中:
Get-ChildItem cert:\my\ |Where-Object{
($TmplExt = $_.Extensions |Where-Object {
$_.Oid.FriendlyName -match 'Certificate Template'
}) -and
$TmplExt.format(0) -match 'MyTemplateName'
} |Remove-Item