Share via


SSLBinding.Create Method [IIS 7 and higher]

Creates a Secure Sockets Layer (SSL) binding.

Syntax

oWebAdmin.Get("SSLBinding").Create(
   IPAddress,
   Port,
   CertificateHash,
   StoreName
);
oWebAdmin.Get("SSLBinding").Create
   IPAddress,
   Port,
   CertificateHash,
   StoreName

Parameters

Name

Description

CertificateHash

A string value that specifies the certificate hash for the SSL binding.

IPAddress

A string value that specifies the IP address for the SSL binding.

Port

A uint32 value that specifies the port number for the SSL binding.

StoreName

A string value that specifies the name of the certificate store for the SSL binding.

Return Value

This method does not return a value.

Remarks

The following script shows the different formats that you can use for the IPAddress parameter:

' This is the standard format for a specific IP address.
oWebAdmin.Get("SSLBinding").Create "172.30.190.122", 443, "fbbca460988a482227ec71122177045e47f9f2ff", "MyStoreName"

' Each of the following formats is an acceptable way to create a secure binding 
' to port 443 on all IP addresses.
oWebAdmin.Get("SSLBinding").Create "*", 443, "fbbca460988a482227ec71122177045e47f9f2ff", "MyStoreName"
oWebAdmin.Get("SSLBinding").Create "0.0.0.0", 443, "fbbca460988a482227ec71122177045e47f9f2ff", "MyStoreName"
oWebAdmin.Get("SSLBinding").Create "", 443, "fbbca460988a482227ec71122177045e47f9f2ff", "MyStoreName"

Example

The following example creates a secure binding and adds it to a Web site.

' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Create the secure binding.
oWebAdmin.Get("SSLBinding").Create "*", 443, "fbbca460988a482227ec71122177045e47f9f2ff", "MyStoreName"

' Create a new binding element.
Set oBinding = oWebAdmin.Get("BindingElement").SpawnInstance_
oBinding.BindingInformation = "*:443:"
oBinding.Protocol = "https"

' Get the default Web site.
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")

' Increase the size of the array in the site's Bindings property.
arrBindings = oSite.Bindings
ReDim Preserve arrBindings(UBound(arrBindings) + 1)

' Add the new binding to the array. 
Set arrBindings(UBound(arrBindings)) = oBinding

' Assign the array to the Site.Bindings property.
oSite.Bindings = arrBindings 
Set oPath = oSite.Put_

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

BindingElement Class [IIS 7 and higher]

SSLBinding Class [IIS 7 and higher]

Site Class [IIS 7 and higher]