Bobcares

How to Bind SSL certificate in IIS Powershell

by | Aug 24, 2023

Learn how to bind SSL certificate in IIS Powershell. Our IIS Support team is here to help you with your questions and concerns.

How to Bind SSL certificate in IIS Powershell

Did you know that binding an SSL certificate in IIS with PowerShell involves configuring our web server to use a specific SSL certificate for secure communications with clients?

How to Bind SSL certificate in IIS Powershell

PowerShell is a scripting language that lets us automate different tasks in Windows environments.

Our experts have put together this step-by-step guide on how to bind an SSL certificate in IIS using PowerShell:

  • First, we have to make sure we have an SSL certificate ready. This certificate has to be installed on our server and available in the Windows certificate store.
  • Then, we have to open a PowerShell window with administrative privileges.
  • Next, the WebAdministration module offers cmdlets for managing IIS configurations. We can import it by running this command:

    Import-Module WebAdministration

  • Now, we can opt to list the current bindings on our IIS sites to verify the existing configuration:

    Get-WebBinding

  • At this point, we have to use the New-WebBinding cmdlet to bind the SSL certificate to a certain site. Here is the syntax:

    New-WebBinding -Name "SiteName" -Protocol "https" -IPAddress "*" -Port 443 -SslFlags 1

    Here, we have to replace “SiteName” with our IIS site name. This command creates a new binding for HTTPS on all IP addresses, using port 443. Additionally, the -SslFlags 1 parameter indicates that the certificate should be used for SSL.

  • Next, we have to find the thumbprint of the SSL certificate we want to bind. We can access it with this command:

    $certThumbprint = (Get-ChildItem -Path Cert:\LocalMachine\My | Where-Object { $_.Subject -like "*ourCertificateCommonName*" }).Thumbprint

    Here, we have to replace “ourCertificateCommonName” with the common name (CN) of our SSL certificate.

  • Now, it is time to assign the SSL certificate to the binding we created:

    $binding = Get-WebBinding -Name "SiteName" -Protocol "https"
    $binding.AddSslCertificate($certThumbprint, "My")

  • Finally, we have to apply the changes by restarting the IIS site.

By this point, we have successfully bound an SSL certificate to an IIS site using PowerShell. This enables secure communication between clients and our web server over HTTPS.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

Today, our Support Techs demonstrated how to bind SSL certificate in IIS.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.