SSLBinding.Create Method1

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 - IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on Windows Server 2008
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF file WebAdministration.mof

See Also

BindingElement Class
SSLBinding Class
Site Class