虚位以待(AD)
虚位以待(AD)
首页 > 脚本专栏 > Powershell > Powershell读取PFX证书并输入密码的脚本分享

Powershell读取PFX证书并输入密码的脚本分享
类别:Powershell   作者:码皇   来源:互联网   点击:

这篇文章主要介绍了Powershell读取PFX证书并输入密码的脚本分享,本文实现直接用脚本输入密码,避免了手动输入密码的麻烦,需要的朋友可以参考下

支持所有PS版本

当你使用Get-PfxCertificate读取PFX证书去签名你的脚本,但是它总是会已交互式方式提示用户去输入密码。

下面介绍怎么通过脚本去提交密码:

复制代码 代码如下:

$PathToPfxFile = 'C:temptest.pfx'
$PFXPassword = 'test'
 
Add-Type -AssemblyName System.Security
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($PathToPfxFile, $PFXPassword, 'Exportable')
 
$cert 

相关热词搜索: Powershell 读取PFX证书 输入密码