【发布时间】:2020-01-03 22:31:48
【问题描述】:
我在尝试将 Windows 商店中的证书导出为 .pfx 格式时遇到了一些问题
以下命令可以正常工作,
Get-ChildItem -Path Cert:\CurrentUser\My\**** | Export-PfxCertificate -FilePath "D:\a.pfx" -Password $securestring
而这不是
Get-ChildItem -Path Cert:\CurrentUser\My | ? {$_.friendlyname -like "zxy*" } | sort -Property FriendlyName | % { Export-PfxCertificate -FilePath "D:\$($_.friendlyname).pfx" -Password $securestring }
错误:Export-PfxCertificate:无法使用指定的命名参数解析参数集。
即使这样也没有
Get-ChildItem -Path Cert:\CurrentUser\My\*********** | Export-PfxCertificate -FilePath "D:\a.pfx" -Password (ConvertTo-SecureString -String $_.FriendlyName -Force -AsPlainText)
错误: ConvertTo-SecureString : 无法将参数绑定到参数“字符串”,因为它为空。
请多指教。。 提前致谢
【问题讨论】:
-
当使用星号作为通配符时,一个就足够了。 ,第二个示例需要输入,第三个示例必须在 -Password {} 周围有一个脚本块,而不是括号 ()。
-
感谢@LotPings,如果用于屏蔽指纹,使用 {} 也不起作用。本德尔的回答奏效了。
标签: powershell certificate ssl-certificate x509certificate