Last active
December 12, 2016 07:36
-
-
Save omkarkhair/574e549a9ea9c3111ae4e83c100e2aba to your computer and use it in GitHub Desktop.
Create a self-signed certificate using PowerShell 'New-SelfSignedCertificate'
This file contains hidden or 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
$dns = "<ENTER_FULLY_QUALIFIED_DOMAIN>" | |
$pwd = "<ENTER_STRONG_PASSWORD>" | |
$exportPath = "<ENTER_PATH_TO_EXPORT_CERTIFICATES_TO>" | |
$certPath = "Cert:\LocalMachine\My\" | |
$cert = New-SelfSignedCertificate -CertStoreLocation $certPath -DnsName $dns | |
$certPath = "$($certPath)\$($cert.Thumbprint)" | |
Write-Host 'Cert path: ' $($certPath) | |
Export-Certificate -cert $certPath -FilePath $exportPath'\lab.cer' | |
$p = ConvertTo-SecureString -String $pwd -Force -AsPlainText | |
Export-PfxCertificate -cert $certPath -FilePath $exportPath'\lab.pfx' -Password $p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment