Created
January 3, 2018 11:12
-
-
Save ukcoderj/dd68cfc4021e90b867df1b0206a7748f to your computer and use it in GitHub Desktop.
Simple Make Cert with Password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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