PowerShell:如何获取“证书模板信息”从我的证书商店? [英] PowerShell: how do I get the "Certificate Template Information" from my certificate store?

查看:132
本文介绍了PowerShell:如何获取“证书模板信息”从我的证书商店?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用以下示例代码:


< p align = left>


new-variable -name userStore -value " currentUser" -option readonly


$ crypto = " System.Security.Cryptography.X509Certificates.X509Store"


$ objStore = new-object $ crypto $ store


$ objstore 打开 "Readonly"


$ colcerts = $ objstore 证书


Write-Host -ForegroundColor blue


"


$( $ colcerts count 证书 in $ store store


他们 列出


"


foreach $ cert in $ colCerts


{


" FriendlyName:$($ cert.FriendlyName)"


"指纹:$($ cert.thumbprint)"


" Subject:$($ cert.subject)`n"


#我找不到列出证书模板信息的任何其他属性


}


$ objstore 关闭 ()




任何想法?


谢谢


JCDS

解决方案

怎么样这...

 

Get-ChildItem Cert:\ CurrentUser \ My |
%{


_ |选择`
Friendlyname,
Thumbprint,
@ {N =" Template"; E = {(


_。扩展名|
?{

 

I am using the sample code below:

 

new-variable -name userStore -value "currentUser" -option readonly

$crypto = "System.Security.Cryptography.X509Certificates.X509Store"

$objStore = new-object $crypto $store

$objstore.Open("Readonly")

$colcerts = $objstore.Certificates

Write-Host -ForegroundColor blue

"

There are $($colcerts.count) certificates in the $store store.

They are listed below:

"

foreach($cert in $colCerts)

{

"FriendlyName: $($cert.FriendlyName)"

"Thumbprint: $($cert.thumbprint)"

"Subject: $($cert.subject)`n"

# I could not find any other properties that would list the Cert Template Information

}

$objstore.Close()

 

 

Any ideas?

Thank you

JCDS

解决方案

How about this...

Get-ChildItem Cert:\CurrentUser\My | % {


_ | Select ` Friendlyname, Thumbprint, @{N="Template";E={(


_.Extensions | ?{


这篇关于PowerShell:如何获取“证书模板信息”从我的证书商店?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆