Skip to content

Instantly share code, notes, and snippets.

@jrahme-cci
Created April 22, 2020 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrahme-cci/30a135c50db93a27bba649ddfb054661 to your computer and use it in GitHub Desktop.
Save jrahme-cci/30a135c50db93a27bba649ddfb054661 to your computer and use it in GitHub Desktop.
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