Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A script to load certificates for windows builds
param(
[Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$false)]
[System.String]
$KeyPath,
[Parameter(Mandatory=$True, Position=1, ValueFromPipeline=$false)]
[System.String]
$KeyPass
)
$Cert = Import-PfxCertificate -FilePath $KeyPath -Password (ConvertTo-SecureString -String "$KeyPass" -AsPlainText -Force) -CertStoreLocation Cert:\LocalMachine\My
Export-Certificate -Cert $Cert -File c:\Cert.sst -Type SST
Import-Certificate -File c:\cert.sst -CertStoreLocation Cert:\LocalMachine\Root
Import-Certificate -File c:\cert.sst -CertStoreLocation Cert:\CurrentUser\My
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment