How To Create A Self-Signed Computer Certificate using PowerShell Step-By-Step; Much Easier Than MakeCert.exe

I need to create a self-signed computer certificate to use for authentication between my Windows Server 2012 Server and Windows Azure.  The same process will work for other versions of windows and for communication with other applications.  In my case, I am using it for Windows Azure Backup but the steps would be the same for other certificates where you want to have a computer authenticate via a self-signed certificate.  With the script the process is super simple and it was written in such a way that you don’t need to make any changes to the script.  In order to achieve this, I need to create the certificate, install it on the local computer and export it to a file so I can then upload it to Windows Azure.  All of this can be done by simply copying and pasting the code into a PowerShell Window or PowerShell ISE window if you want to change the parameters by simply changing two variable and running it!  The two variables are

1)  Where do you want to store the exported file. ($certfilepath = “c:”

2) What you want to call the certificate  ($certfilename = “GuruCert_”)

Experience Microsoft’s latest products with these FREE downloads!

PowerShell Source Follows:  Downloadable .TXT version of script can be found at:


OK… So it does not look that simple right… Well that is because it is doing plenty. However, all you have to do is paste into a PowerShell command window and watch the magic. If you do want to tweak it; like changing the name of the cert or the output location…  You can ignore all the lines that start with a pound (#)  they are just comments.  Then it is the first two or three lines of the script that you have to change to put in your own values.


1) Run PowerShell from the machine you want to create certificate on: To run any application with elevated privileges (as Administrator) simply right-click on that program from the menu and select Run as Administrator.  Step-By-Step: Start then type PowerShell then Right-Click on PowerShell icon and select Run as Administrator.  This is also known as Administrative Permissions.

2) Highlight the text between the lines above; right-click select copy

3) Right-click the PowerShell window to paste and watch the magic…

4) Navigate to c: to see your new certificate which will be called “GuruCert_YourMachineName

If you found this helpful, please Tweet:

Thanks @ITProGuru for #PowerShell How To Create A Self-Signed Computer Certificate using PowerShell Step-By-Step

If you want to see the certificate in the store after it is installed you can access it by: Press clip_image002-W; type Cert; Click Manage Computer Certificates; click Yes on user access control; Expand… Certificates – Local Computer – PersonalCertificates. Double-Click the cert to open it.