Create a Self Signed Certificate (SSL) By Power Shell

Some times we need SSL certificate for local host website so we can create by power shell.

So i love power shell and its working looks like charm that's why i prefer it. so i put script here to create SSL. just follow that.

so open power shell as admin mode and copy this script and change your DNS name. means put your host name here and press enter. it will show you created details as per certificate.


$dnsname = "www.etc.com"

$pwd = ConvertTo-SecureString -String "123456" -Force -AsPlainText

$print = (New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname $dnsname).Thumbprint

$path = "c:\Windows\temp\cert.pfx"

Export-PfxCertificate -cert cert:\localMachine\my\$print -FilePath $path -Password $pwd

$file = ( Get-ChildItem -Path $path )




Go IIS and select binding for particualr website where you want to bind and select https. Under SSL Certificate dropdown you will found certificate which you created earlier.



Hope this will help you. Cheers!


Happy Coding!

Comments

Popular posts from this blog

Difference between shared, Versioned and Unversioned fileds in sitecore

How to find broken links in Sitecore.

Setup First Sitecore Helix Example From Scratch (Blank solution)