Skip to content

Instantly share code, notes, and snippets.

@slavaceornea
Last active June 2, 2016 11:06
Show Gist options
  • Save slavaceornea/d4ce526ae87832fb6473c8c79cf7b920 to your computer and use it in GitHub Desktop.
Save slavaceornea/d4ce526ae87832fb6473c8c79cf7b920 to your computer and use it in GitHub Desktop.
Powershell script creates and exports self-signed certificate as .pfx file.
New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname selfsignedcertificate.internal
# change Pa$$word with your own
$pwd = ConvertTo-SecureString -String "{Pa$$word}" -Force -AsPlainText
# in between parantheses on the next line use the ID you get by running the first command
Export-PfxCertificate -cert Cert:\localMachine\my\{15034633B1C5D9FB68EAD7984B7816C1D73D27E2} -FilePath c:\temp\selfsignedcertificate.internal.pfx -Password $pwd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment