Can someone help me with the following question please.
I am using the following script
' 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_
Which I found at the following location
http://msdn.microsoft.com/en-us/library/ms691440(v=vs.90).aspx
The reason I chose this approach as opposed to using the PowerShell
New-WebBinding cmdlet is I want to associate with a particular Certificate and I do not see the option in this cmdlet to specify a certificate hash for the binding (is there an option here I am missing?)
The problem I have is the following
I am adding a ‘Host Header’ (Host Name column as it appear in the IIS 7 Admin GUI under bindings)
e.g. on the above line rather than just
oBinding.BindingInformation = "*:443:"
I am using for example.
oBinding.BindingInformation = "*:443:MyHostHeader"
The works ( or appears to work at first glance) is as much as if you go into the GUI would will see the new binding appear along with the relevant port number, IP address, Host Name (Host Header), great.
Now the problem, the Host header (Host Name column) disappears e.g. blanks out. This tends to happen (although not tried every scenario) when you go into edit, view the certificate which is bound to the site, which is all correct. I do not make any changed
when I choose edit, I am just viewing the information re the certificate. Sometimes you need to come of the IIS Admin UI and go back in other times you will see the column blank off when clicking back to main tab after coming out of edit section.
I am wondering if this may be happening because the IP Address/Port combination (e.g. 10.10.10.10 443) is already unique and therefore no need for a host header to distinguish it from another site bound to the same port/IP address, so the system itself just
gets rid of it?
Or is this example missing a SetInfo() or CommitChanges() ?
I was also trying to figure out how to do the same thing via the ADSI IIS interface e.g. PowerShell [ADSI]”IIS://MyServer/MySite” either look up the binding info and create/update the binding info
Any help most welcome
Thanks
Ernie