Skip to content

Instantly share code, notes, and snippets.

@ukcoderj
Created January 3, 2018 11:12
Show Gist options
  • Save ukcoderj/dd68cfc4021e90b867df1b0206a7748f to your computer and use it in GitHub Desktop.
Save ukcoderj/dd68cfc4021e90b867df1b0206a7748f to your computer and use it in GitHub Desktop.
Simple Make Cert with Password
$certName = "mycert.mydomain.com"
$pwdString = "pa55word"
$certNamePfxPath = "C:\temp\mycert.mydomain.com.pfx"
$output = New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname $certName
$pwd = ConvertTo-SecureString -String $pwdString -Force -AsPlainText
$thumb = $output.Thumbprint
$thumb
$certAddress = "cert:\localMachine\my\$thumb"
Export-PfxCertificate -cert $certAddress -FilePath $certNamePfxPath -Password $pwd
# install to "local computer > personal" for IIS to pick up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment