【问题标题】:How to get powershell IIS Instance and associated certificate thumbprints如何获取 powershell IIS 实例和相关的证书指纹
【发布时间】:2018-10-30 14:32:38
【问题描述】:

我正在尝试列出所有 IIS 站点及其相关的证书指纹。

我真的只是想要这样

IIS 站点,指纹。

看起来很简单,但我这辈子都做不到。 (注意我想要actaull IIS 站点,而不是友好名称或证书主题)

我可以单独获取它们,但我如何加入它以显示两者。

$sites = Get-Website | ? { $_.State -eq "Started" } | % { $_.Name }
$certs = Get-ChildItem IIS:SSLBindings | ? {
           $sites -contains $_.Sites.Value
         } | % { $_.Thumbprint } 

【问题讨论】:

    标签: powershell iis certificate windows-server-2012


    【解决方案1】:

    试试这个:

        $certs = Get-ChildItem IIS:SSLBindings
    
        Get-Website | 
            Where-Object State -eq "Started" |
                ForEach-Object {
                    $siteName = $_.Name
                    [PsCustomObject]@{
                        Site=$siteName
                        CertThumb=($certs | Where-Object {$_.Sites.value -contains $siteName}).Thumbprint
                    }
                }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-04-19
      • 2020-02-12
      • 1970-01-01
      • 1970-01-01
      • 2015-01-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多