The place to get all your scripts, tutorials and articles for different requirements in PowerShell.

In some of my testing, I wanted to have SSL certificates that I could use and trash as I needed to without having to pay for anything because SSL certificates are expensive. I used PowerShell to create a Self Signed Certificate and then export it with the .PFX extension, below is the output of this:

Testing in exchange 2019: successfully generated a self-signed pfx certificate for enhanced security testing


The 3x liner script is pretty straight forward, in the real world you would not use a dummy password as I have but something more complex, below is the script:

$MySSLcertificate = New-SelfSignedCertificate -DnsName <name> -CertStoreLocation cert:\LocalMachine\My
$password = ConvertTo-SecureString -String "Password123" -Force -AsPlainText
Export-PfxCertificate -Cert $MySSLcertificate -FilePath C:\Installs\SSLCert.pfx -Password $password

The only thing you need to modify here is the information next to “-DnsName” and then the password and path where you want to save the .PFX file.

Hope it helps.


    Discover more from Everything-PowerShell

    Subscribe now to keep reading and get access to the full archive.

    Continue reading