【问题标题】:How can I use PowerShell to find a website's certificate?如何使用 PowerShell 查找网站的证书?
【发布时间】:2012-03-17 04:06:56
【问题描述】:

我正在尝试使用 PowerShell 查询网站并查看它用于 HTTPS 绑定的 SSL 证书(名称)。然后我想回溯看看是什么CA颁发了证书。

我无法查询网站以了解绑定的 SSL 证书。 IIS 7.5 GUI 显示一个友好名称。

在我获得网站 SSL 证书后,计划是使用 PowerShell 通过FriendlyName(或指纹或其他值)搜索证书存储。

这是我目前所拥有的:

  • 查询存储以获取证书信息:

    get-childitem cert:\LocalMachine\my | ft issuer, subject, notafter, FriendlyName
    
  • 检查活动绑定

    get-itemproperty 'IIS:\Sites\(SITENAME)' -name bindings
    

我不确定这些信息存储在哪里,我也无法使用 PowerShell 在 web.configapplicationhost.config 中搜索它。到目前为止,Google 搜索还没有帮助。

感谢任何有关如何在 IIS 中处理/存储证书的信息、信息链接或文档。

【问题讨论】:

    标签: powershell certificate iis-7.5 ssl-certificate powershell-2.0


    【解决方案1】:

    要获得站点 SSL 绑定,请查看:IIS:\SslBinding

    你可以像这样获取绑定端口:

    dir IIS:\SslBindings | ? {$_.Port -eq 1443} | Select *
    

    ThumbprintStore 属性将很有趣。

    您可以使用以下方法获取实际证书:

    get-item cert:\LocalMachine\$theStore\$theThumbprint
    

    例如

    get-item cert:\LocalMachine\My\29F025A78F537D931A8CF05B00EB81DB84160CF3 | select *
    

    【讨论】:

    • @colo_joe Np,这回答了你的问题吗?
    猜你喜欢
    • 1970-01-01
    • 2014-05-28
    • 2016-04-16
    • 2021-05-21
    • 2017-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多