Skip to content

Instantly share code, notes, and snippets.

@jrahme-cci
Created April 22, 2020 19:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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