您现在的位置是:网站首页> 编程资料编程资料
Powershell读取PFX证书并输入密码的脚本分享_PowerShell_
2023-05-26
320人已围观
简介 Powershell读取PFX证书并输入密码的脚本分享_PowerShell_
支持所有PS版本
当你使用Get-PfxCertificate读取PFX证书去签名你的脚本,但是它总是会已交互式方式提示用户去输入密码。
下面介绍怎么通过脚本去提交密码:
复制代码 代码如下:
$PathToPfxFile = 'C:\temp\test.pfx'
$PFXPassword = 'test'
Add-Type -AssemblyName System.Security
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($PathToPfxFile, $PFXPassword, 'Exportable')
$cert
您可能感兴趣的文章:
相关内容
- Powershell改变脚本执行优先权的代码分享_PowerShell_
- Powershell实现导入安装证书功能脚本分享_PowerShell_
- Windows Powershell 定义函数_PowerShell_
- Windows Powershell Switch 循环_PowerShell_
- Windows Powershell For 循环_PowerShell_
- Powershell小技巧之使用WS-Man来调用PowerShell命令_PowerShell_
- 使用HTTP api简单的远程执行PowerShell脚本_PowerShell_
- Powershell小技巧之开启关闭远程连接_PowerShell_
- PowerShell实现在控制台中插入绿色的打勾符号_PowerShell_
- PowerShell中终止管道的方法_PowerShell_
