Need a Server? Build it in the cloud for free


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 – Personal – Certificates. Double-Click the cert to open it.

This entry was posted in Step-By-Step and tagged , , , , , by Dan Stolts ITProGuru. Bookmark the permalink.

About Dan Stolts ITProGuru

Dan Stolts (The "ITProGuru") is a technology expert who is a master of systems management and security. He is proficient in many Microsoft products especially in the server area (Windows Server, System Center, Exchange, SharePoint, Virtualization, Etc) and holds many certifications including MCT, MCITP, MCSE, TS, etc. Dan is currently specializing in System Management and Security and is also very passionate about virtualization technologies. Dan is and has been a very active member of the community. He is president of Boston User Groups, Founder of Virtualization Group Boston, Founder of North East Leaders and serves on many IT Community group boards. He is in the process of writing his first book on building technology communities. He is a believer in social networking and can be reached on twitter @ITProGuru. He has participated in many non-technology community groups such as: Rotary Club, Lions Club, local Chambers of Commerce and is a mentor for the local high schools. Dan is an enthusiastic advocate of technology and is passionate about helping others. Dan's lifelong passion has been and continues to be to help and teach others!

Leave a Reply