Creating Self Signed Certificates in Windows 10

Did you know you can create self signed certificates in Windows 10?
To be honest you can do it in Windows 8.1 and Windows Server 2012 R2 as well 🙂

I will be using self signed certificates in my WAP lab.

First you start Powershell and use the New-SelfSignedCertificate cmdlet.

To understand how to use the cmdlet I type:

help New-SelfSignedCertificate

PS C:\> help New-SelfSignedCertificate

NAME
New-SelfSignedCertificate

SYNTAX
New-SelfSignedCertificate [-DnsName <string[]>] [-CloneCert <Certificate>] [-CertStoreLocation <string>] [-WhatIf]
[-Confirm]  [<CommonParameters>]

ALIASES
None

REMARKS
Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
— To download and install Help files for the module that includes this cmdlet, use Update-Help.
— To view the Help topic for this cmdlet online, type: “Get-Help New-SelfSignedCertificate -Online” or
go to http://go.microsoft.com/fwlink/?LinkId=386828.

To create my certificate I enter the command:

New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname *.awesome.se

Make note of the certificate thumb print we are needing that when we export the certificate.

image

If we then use the Export-PfxCertificate to export our certificate we might get the following error message stating that Export-PfxCertificate : Password and ProtectTo cannot both be absent.

image

If you add the -Password YourPassword to your command you will recieve another error message stating:
Export-PfxCertificate : Cannot bind parameter ‘Password’. Cannot convert the “YourPassword” value of type “System.Strin
g” to type “System.Security.SecureString”.

image

What we need to do is to create a variable and store our password and use that in our export command.

$CertPwd = ConvertTo-SecureString -String “YourPassword” -Force –AsPlainText

The complete export command looks like this:
Export-PfxCertificate -cert cert:\localMachine\my\BEF89AC19107DEB96494BCDF589791B689FBEC96 -FilePath c:\temp\AwesomeCert.pfx -Password $CertPwd

Advertisements

One Response to Creating Self Signed Certificates in Windows 10

  1. DutchGlory says:

    here a Powershell script to generate a certificate with your username and computername. Run as admin!!
    http://tiny.cc/2dro7x
    run Powershell and Powershell ISE as admin
    http://tiny.cc/mfro7x

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: