使用Get-PfxCertificate自动签署powershell脚本

El *_*ldo 3 powershell certificate

我必须使用远程机器上的证书对远程脚本进行签名,我从中获得.pfx文件.

我想通过编程方式为Get-PfxCertificate提供密码来自动化脚本.

所以问题是:

是否有可能以某种方式以编程方式提供所需的密码

GET-PfxCertificate?

Nat*_*iri 7

$CertPath = "my.pfx"
$CertPass = "mypw"
$Cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($CertPath, $CertPass)
Set-AuthenticodeSignature -Certificate $Cert -TimeStampServer http://timestamp.verisign.com/scripts/timstamp.dll -FilePath $OutputFilename
Run Code Online (Sandbox Code Playgroud)

确保您具有适当的权限,否则您将无法创建X509Certificate2对象的实例.