如何使用Powershell访问证书ExtendedProperty? [英] How can I access Certificate ExtendedProperties using powershell?

查看:85
本文介绍了如何使用Powershell访问证书ExtendedProperty?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在窗口的证书管理器中打开证书的属性窗口,则将看到一个友好名称和描述字段。我试图通过powershell以编程方式到达description字段。

If you open the properties window of a certificate in the certificate manager in windows you will see both a friendlyname and description field. I'm trying to get to the description field programatically via powershell.

通过powershell的证书提供者cert访问证书时:您得到一个仅将FriendlyName公开为Name的对象

When accessing the certificates via powershell's certificate provider cert: you get an object that only exposes the FriendlyName as Name.

据我所知,这都是CAPICOM API的包装。描述或get_extendedproperties方法都没有公开。

As far as I can tell, this is all a wrapper to the CAPICOM APIs. Neither the description or the get_extendedproperties method are exposed.

如何通过powershell麻烦地访问描述字段?请注意,我试图简单地

How can I access the description field problematically via powershell? Please note that I tried to simply do

$store = new-object -com "CAPICOM.Store" 

直接在此链接,但在64位Win2K8盒上却出现80040154错误。

to use the CAPICOM api directly ala This Link, but I get a 80040154 error on my 64bit Win2K8 box.

推荐答案

打开x86 Powershell而不是x64。这应该使您开始:

Open x86 Powershell instead of x64. This should get you started:

$store = new-object -com "CAPICOM.Store"
$store.Open(2, "CA", 1)
$store | fl *
$store.Certificates
$store.Certificates | %{ $_.display() }
$store.Certificates | %{ $_.extendedproperties() }

这篇关于如何使用Powershell访问证书ExtendedProperty?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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