Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从powershell中的目录获取ssl证书指纹_Powershell_Ssl - Fatal编程技术网

从powershell中的目录获取ssl证书指纹

从powershell中的目录获取ssl证书指纹,powershell,ssl,Powershell,Ssl,我有一个应用程序正在引发异常,因为我的计算机上没有安装ssl证书。我知道丢失证书的tumbprint,但我不知道如何按名称查找它 我已经这样做了: Get-ChildItem -Path Cert:\LocalMachine\My 并验证我需要的证书未安装。我的源代码目录(c:\source\project\certs)中有证书,但我需要知道要安装目录中的哪个证书 有没有办法像上面一行那样,从“c:\source\project\certs”文件夹而不是证书存储区列出证书?这应该可以做到: $

我有一个应用程序正在引发异常,因为我的计算机上没有安装ssl证书。我知道丢失证书的tumbprint,但我不知道如何按名称查找它

我已经这样做了:

Get-ChildItem -Path Cert:\LocalMachine\My
并验证我需要的证书未安装。我的源代码目录(c:\source\project\certs)中有证书,但我需要知道要安装目录中的哪个证书


有没有办法像上面一行那样,从“c:\source\project\certs”文件夹而不是证书存储区列出证书?

这应该可以做到:

$password= ConvertTo-SecureString -String "Pass" -AsPlainText -Force

Get-ChildItem -Path "C:\source\project\certs" -Filter *.pfx | % {
    $certobject = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
    $certobject.import($_.FullName, $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::DefaultKeySet)
    $certobject.Thumbprint
}

@PeterSchneider不,它不会将它们导入证书存储,只是导入到对象中