PowerShell Snap-in: Configuring SSL with the IIS PowerShell Snap-in (2024)

  • Article

by IIS Team

To enable SSL three steps are involved:

  1. Acquiring and installing a certificate
  2. Creating an SSL binding in IIS
  3. Assigning the certificate to the IP:Port of the IIS binding

and optionally:

  • Enforcing SSL on your web-site

Acquiring and Installing a Certificate

Acquiring certificates is a tricky business. The users of your web-site have to trust the certificate and that's why you have to get it from a trusted Certificate Authority. For testing purposes you can make your own certificate however. For this walkthrough we will use a so-called self-signed certificate. The tool that helps us creating a self-signed certificate is called MAKECERT and is part of the Visual Studio SDK Tools. The following MAKECERT command will create a self-signed certificate and automatically install it in the "my" Windows Certificate Store:

makecert -r -pe -n "CN=MyTestServer" -b 07/01/2008 -e 07/01/2010 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12

You can look at the certificates in the certificate store using the certificate provider:

PS IIS:\> dir cert:\localmachine\my Directory: Microsoft.PowerShell.Security\Certificate::localmachine\myThumbprint Subject---------- -------7ABF581E134280162AFFFC81E62011787B3B19B5 CN=MyTestServer

Note

Your certificate thumbprint will be different!

Now lets use the IIS PowerShell Snap-in to create an SSL binding and associate it with the certificate we just created

Creating an SSL Binding

We are adding the SSL binding to the Default Web Site using one of the task-based cmdlets called New-WebBinding:

PS IIS:\> New-WebBinding -Name "Default Web Site" -IP "*" -Port 443 -Protocol https

You can look at the binding collection using the following command:

PS IIS:\> Get-WebBinding 'Default Web Site'
protocol bindingInformation-------- ------------------http *:80:https *:443:

Assigning the Certificate to the IP:Port of the IIS Binding

Now it gets a bit tricky because SSL settings get stored in the HTTP.SYS configuration store and the naming conventions are a bit different.

  1. In HTTP.SYS you have to use 0.0.0.0 to specify all IP addresses; in IIS you use an asterisk (*).
  2. In IIS you use ":" to separate the binding. Because PowerShell sees a colon as a drive indicator an exclamation mark is used instead:

You can CD into the IIS:\SslBindings directory and query the existing SSL bindings. The directory will be empty on an IIS default install:

PS IIS:\> cd SslBindingsPS IIS:\SslBindings> dir

Now you can use the certificate hash we got in step one and associate it with all IP addresses (0.0.0.0) and the SSL port 443:

PS IIS:\SslBindings> get-item cert:\LocalMachine\MY\7ABF581E134280162AFFFC81E62011787B3B19B5 | new-item 0.0.0.0!443

The previous command generated the following SSL Binding:

IP Address Port Store Sites---------- ---- ----- -----0.0.0.0 443 My Default Web Site

SSL is ready to go now and you can browse to your site by entering https://localhost.

Summary

It is fairly straightforward process to set up SSL with PowerShell. You need to get a certificate, create an SSL binding in IIS and then use the IP and Port of the IIS binding to create a SSL binding in HTTP.SYS.

PowerShell Snap-in: Configuring SSL with the IIS PowerShell Snap-in (2024)
Top Articles
HackTool:Win32/Malagent!MSR threat description - Microsoft Security Intelligence
You Can Use Your Costco Membership to Score Major Vacation Deals
Finance Minor Osu
K2 Spice Diablo
Joes Barbershop Maricopa Az
Irrationale Kitchen
General Aviation Terminal / GAT
Michelob Ultra Peace Treaty Commercial Cast
Serenity Nail Salon Brentwood Tn
A Beginner's Guide to Silverlight
Olivia Dunne 2023: Puerto Rico
Tom DiVecchio - LILLY BROADCASTING | LinkedIn
Craigslist Illinois Bloomington
Amaya Hodges Missing
Check From Po Box 1111 Charlotte Nc 28201
Lima Crime Stoppers
Cobblemon Resource Pack
Cabelas Des Moines
Becker-Hunt Funeral Home Obituaries
New Anime Plot Copypasta
Raley Scrubs - Midtown
Last Usps Pickup Near Me
Dwarf Fortress Polish Stones
Forexfactory Calendar Today
Lausd Salary Table 2023 24 Classified
Waite And Son Brunswick
Myjohnshopkins Mychart
2487872771
International Medical Insurance for Employers from Aetna - Global Health Plans for Expatriates & Business Travel Employees | Aetna
Peekaboo Soft Medium Precious skin Brown | Fendi
Union Supply Direct Wisconsin
Soap2Day That 70S Show
Company Search Subscription Service
Bedford Barbers Nyc
The Exorcist: Believer Showtimes Near Regal Jack London
20.000 Euro Kredit: Online und unkompliziert beantragen | Santander
Www.labcorp.com
Numbrix May 19 2019
Hal Leonard Library
Wv Mugshots 2023
The Menu Showtimes Near Regal Edwards Ontario Mountain Village
Dmvfl Login
Bodypump 116 Tracklist
Miles City Montana Craigslist
609-718-7432
Rimworld Prison Break
25 Best Things to Do in Bremerton, WA - Travel Lens
Results & Winning Numbers for Last Year - Pick 3 Midday
Behind the Casefiles - Dnepropetrovsk Maniacs - Eileen Ormsby
Miami Valley Harness Picks
Fcs East Rhinos
7Th Gear Exotics Tampa
Latest Posts
Article information

Author: Eusebia Nader

Last Updated:

Views: 6363

Rating: 5 / 5 (60 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Eusebia Nader

Birthday: 1994-11-11

Address: Apt. 721 977 Ebert Meadows, Jereville, GA 73618-6603

Phone: +2316203969400

Job: International Farming Consultant

Hobby: Reading, Photography, Shooting, Singing, Magic, Kayaking, Mushroom hunting

Introduction: My name is Eusebia Nader, I am a encouraging, brainy, lively, nice, famous, healthy, clever person who loves writing and wants to share my knowledge and understanding with you.