Powershell command to generate a self-signed SSL certificate

11/16/2019
Back to List

 Generating the certificate

To generate a self-signed SSL certificate using Powershell run the following command.

New-SelfSignedCertificate -DnsName localhost -CertStoreLocation cert:\LocalMachine\My

You can also replace "localhost" with the hostname if you like.

New-SelfSignedCertificate -DnsName devbox -CertStoreLocation cert:\LocalMachine\My

To include multiple domains or subdomains, separate them with commas.

New-SelfSignedCertificate -DnsName "devbox.local", "www.devbox.local" -CertStoreLocation cert:\LocalMachine\My

Trusting the certificate

  1. Open MMC by going to Start > Run and typing "mmc.exe"
  2. Open the "File" menu and select "Add/Remove Snap-in"
    MMC Add/Remove Snap-In
  3. From the "Available Snap-Ins list, choose "Certificates", then click the "Add" button.
    MMC Add Certificates Snap-In
  4. Click finish on the following dialog.
    MMC Snap-In Account
  5. Navigate to Console Root > Certificates - Current User > Personal > Certificates.
    MMC Certificate Store Tree
  6. Right-click your certificate and choose All Tasks > Export.
    MMC Certificate Export Menu
  7. The Certificate Export Wizard will appear, click "Next".
    MMC Certificate Export Wizard
  8. Choose "Yes, export the private key", then click "Next".
    MMC Export Private Key
  9. Choose "Personal Information Exchange - PKCS #12 (.PFX)", and select the options show below.
    MMC Export PFX
  10. Specify a password, change the encryption type to SHA256, and then click "Next".
    MMC PFX Export Password
  11. Specify a file path to export the .pfx file to, then click "Next".
    MMC PFX Export Filename
  12. Review your export options and then click "Finish".
    MMC Certificate Export Finish
  13. You should see a message that "The export was successful". Click "OK".
    MMC Export Successful
  14. Navigate to Console Root > Certificates - Current User > Trusted Root Certification Authorities > Certificates.
    Trusted Root CA Tree
  15. Right-click on the "Certificates" node, then choose All Tasks > Import...
    MMC Certificate Import Menu
  16. The Certificate Import Wizard will appear. Click "Next".
    MMC Certificate Import Wizard
  17. Browse to and select your exported .pfx file, then click "Next".
    MMC Certificate Import Browse file
  18. Enter the password the private key was protected with, then click "Next".
    MMC Certificate Import Password
  19. Make sure the "Trusted Root Certification Authorities" store is the specified target and then click "Next".
    MMC Certificate Import Target Store
  20. Verify your import settings and then click "Finish".
    MMC Certificate Import Finish
  21. You should get a message stating "The import was successful."
    MMC Certificate Import Successful

And you are done.  You might need to close and reopen your web browser before it will stop complaining about the certificate. 


SuperChad
Gravatar About Sean Nelson
I like codes and stuff.

12 comments
Gravatar Grierie - 10/26/2022 5:40:38 PM
Гў Jamie EtmfnqtYyHSdIecPyey 6 17 2022 <a href=https://stromectol.autos/>stromectol rezeptfrei</a>
Gravatar expetbape - 1/24/2023 4:31:40 AM
Educate the patient about the illness, how to manage stress, and inject dexamethasone or other glucocorticoids intramuscularly or subcutaneously <a href=http://propecia.bond>cheapest propecia uk</a> Associations between beer, wine, and liquor consumption and lung cancer risk a meta analysis
Gravatar ambimoula - 1/28/2023 10:40:13 AM
1 x 10 4 ml cysts and 10Ојl of experimental compounds from the stock dilution plates were combined for screening into clear 96 well treated tissue culture plate Corning, NY for 24 hours at 27 C <a href=http://nolvadex.hair>buy nolvadex</a> 103 The maximum tolerated dose was 80 mg
Gravatar Vahcryday - 1/31/2023 11:28:04 AM
In addition, participants were randomized to receive either placebo n 235 or one of five drugs representing commonly used classes of antihypertensive agents 1 a ОІ blocker acebutolol, 400 mg d, n 132, 2 a calcium antagonist amlodipine, 5 mg d, n 131, 3 a diuretic chlorthalidone, 15 mg d, n 136, 4 an О± 1 antagonist doxazosin, 2 mg d, n 134, or 5 an angiotensin converting enzyme inhibitor enalapril, 5 mg d, n 135 <a href=https://nolvadex.pics>nolvadex</a>
Gravatar londips - 1/31/2023 11:45:43 AM
anastrozole composant ibuprofene 400 But many inside and outside the country say Myanmar has yet to create a framework for productive, lasting worker employer dialogues that will protect workers and ensure that employers have a safe, reliable workforce <a href=https://acialis.top>tadalafil cialis from india</a>
Gravatar kimmemi - 2/1/2023 11:17:11 PM
Ocular Graft versus Host Disease after hematopoietic cell transplantation expert review from the late effects and quality of life working committee of the CIBMTR and transplant complications working party of the EBMT <a href=http://propecia.skin>proscar</a>
Gravatar inwarse - 2/2/2023 7:30:08 PM
Most notably, how to conduct appropriate active control groups needed more concentrations <a href=https://nolvadex.best>tamoxifen and uterine cancer</a>
Gravatar inerrigue - 2/3/2023 7:20:47 AM
There isn t a particular benefit to doing so, but nor is it going to set you back <a href=http://stromectol.one>stromectol 3 mg price</a>
Gravatar cletuax - 2/4/2023 2:02:15 PM
<a href=https://cialis.hair>buy online cialis</a> Major depression is more than just feeling down for a few days
Gravatar IRRENNA - 2/5/2023 6:18:29 AM
<a href=http://zithromax.buzz>azithromycin 500 mg</a> In addition, in vitro or in vivo assays may be employed to help identify optimal dosing ranges
Gravatar quedehave - 6/6/2022 2:59:59 AM
Vwsszv [url=https://newfasttadalafil.com/]Cialis[/url] CLINICAL USES OF SOUND The most familiar clinical use of sound is in the analysis of body sounds with a stethoscope. Mhrkia <a href=https://newfasttadalafil.com/>Cialis</a> Dmggct women who take cialis https://newfasttadalafil.com/ - buy cheap generic cialis online acheter cialis ligne
Gravatar blercib - 2/16/2023 2:05:15 PM
s medical history, including an assessment of kidney function and volume status Fig <a href=http://zithromax.top>what is zithromax</a> In the recent game Cart Life, you play as one of three downtrodden protagonists working a low paying job in America