Powershell实现导入安装证书功能脚本分享
支持所有版本。
通常从文件加载一个证书并且安装它到指定的库。可以使用下面的脚本:
$pfxpath='C:\temp\test.pfx'
$password='test'
[System.Security.Cryptography.X509Certificates.StoreLocation]$Store='CurrentUser'
$StoreName='root'
Add-Type-AssemblyNameSystem.Security
$certificate=New-ObjectSystem.Security.Cryptography.X509Certificates.X509Certificate2
$certificate.Import($pfxpath,$password,'Exportable')
$Store=New-Objectsystem.security.cryptography.X509Certificates.x509Store($StoreName,$StoreLocation)
$Store.Open('ReadWrite')
$Store.Add($certificate)
$Store.Close()
现在你可以配置这个脚本,指定证书的位置和密码。你还可以指定存储位置(当前用户或本地计算机)并添加证书(例如被信任的根证书)或私有证书。
热门推荐
10 八一幼儿祝福语大全简短
11 公司乔迁食堂祝福语简短
12 婚礼结束聚餐祝福语简短
13 儿媳买车妈妈祝福语简短
14 毕业送礼老师祝福语简短
15 同事辞职正常祝福语简短
16 恭贺新婚文案祝福语简短
17 金店立秋祝福语简短英文
18 婆婆高寿祝福语大全简短