我正在使用下面的powershell搜索来获取用户帐户的3个证书拇指指纹。
get-childitem -path $certPath | where-object {$_.Subject -match "$Displayname"} | Where-Object {$_.EnhancedKeyUsageList -match "EKU OID"}其中两个证书具有增强的密钥用法,我可以很容易地搜索。其中一个证书没有增强的密钥使用。我尝试过各种比较来搜索空值,但我的所有搜索都返回其他两个证书。我试过-match,-notmatch,-like和-notlike。对我如何挑选出这张证书有什么建议吗?
发布于 2018-05-18 15:31:04
通过使用以下搜索参数,我能够获得证书
Get-ChildItem cert:\my\ |Where-Object{
($TmplExt = $_.Extensions |Where-Object {
$_.Oid.FriendlyName -match 'Certificate Template'}) -and
$TmplExt.format(0) -match 'MyTemplateName'}我从这篇文章中找到了一个例子:How can I delete certificate that has specific template?
https://stackoverflow.com/questions/50412628
复制相似问题