HOWTO: Insert Multiple Website Bindings


Hmm… I am somewhat confused by proclamations of asking for advice when things are supposedly working correctly. I guess I will try and answer the question…


Question


David,


I have tried using your script and things are working correctly. Please advise.


I run the following which I think would now allow me to have 2 host headers for my SSL site


iisscript.vbs <SecureBindings> “:443:Site1.DNSName.com” “:443:Site1.DNSName.com”,”:443:Site2.DNSName.com”


Instead of getting 2 list entries when I run:


cscript.exe adsutil.vbs get <SecureBindings>.


I only get one entry and netither host header works: “:443:Site1.DNSName.com”,”:443:Site2.DNSName.com”


Do I have my syntax wrong?


Thanks,


Answer:


I love rhetorical questions. Yes, the syntax has to be wrong, because if it was right, we wouldn’t be having this discussion. 🙂


Before going any further, I need to note that the referenced tool is located here.

The way my tool works to edit a LIST data type is by:


  1. Identify the IIS Property of LIST data type to manipulate
  2. Give a string to match against the specific LIST item that you want to select for manipulation
  3. Give a string that will either replace or insert before the matched item from #2. This depends on whether /INSERT is given or not

This is better than ADSUTIL.VBS, which can only stomp over the entire LIST data value and NOT manipulate any one item in the LIST.

Given this information, let’s see what you are doing. You gave:

iisscript.vbs <SecureBindings> “:443:Site1.DNSName.com” “:443:Site1.DNSName.com”,”:443:Site2.DNSName.com”

Which means to locate the SecureBindings property, find a LIST item containing “:443:Site1.DNSName.com” and replace its value with “:443:Site1.DNSName.com”,”:443:Site2.DNSName.com”


As you have stated yourself, all you wanted to do is to make the SecureBindings property have one additional LIST item (this is what it means to add a SecureBinding). Instead, what you did was change one LIST item to a new value containing a comma.


Hmm, I am not a rocket scientist, so can you point me to any documentation that says that comma-delimited configuration values are interpreted or manipulated as multiple LIST items by IIS or any tool? Ah-hah, I didn’t think so… 😉


Now, here are two ways add multiple LIST items at your disposal:



  1. ADSUTIL.VBS SET <SecureBindings> “:443:Site1.DNSName.com” “:443:Site2.DNSName.com”
  2. ChgList.vbs <SecureBindings> “:443:Site1.DNSName.com” “:443:Site2.DNSName.com” /INSERT

With ADSUTIL.VBS, you are simply stomping over the SecureBindings property with a new value that contains two LIST items. With my tool, you are inserting a new LIST item ahead of the matching item (so it will gracefully add a new LIST item to whatever LIST items are already there). Both actions should produce multiple LIST items and suffice for what you want to do.


//David

Comments (4)

  1. Randy L. Smith says:

    This is promising, David, but how do you get the ":443:Site1.DNSName.com" in the first place to know which/what to search for and overwrite?

    RLS

    randy@mcpi.com

  2. David.Wang says:

    Randy – ADSUTIL.VBS GET W3SVC/1/SecureBindings retrieves the configured SSL Bindings, which then allow you to determine which to search for and overwrite.

    Or you can choose "FIRST" or "LAST" with the /INSERT option to just insert at a certain location regardless of duplicates.

    The possibilities for manipulating a LIST data type are endless once you can:

    1. ENUMERATE a list using ADSUTIL or ChgList.vbs <node> foo foo

    2. INSERT/REPLACE/DELETE a list entry based on INDEX (FIRST/LAST) or RegExp match of list entry.

    //David

  3. Magnus von Rosen says:

    Just wanna say thanks for doing this work. Saved me some time. /The Swedish ch…I mean Admin.

  4. Joe says:

    I’m unable to insert multiple HH values in one command.

    it fails on second HH value with unknown parameter.

    For example, I want to add two new HH values

    :80:site10.contoso.com and :80:site11.contoso.com

    I run

    ChgList.vbs <SecureBindings> ""  ":80:Site10.contoso.com" ":80:Site11.conotos.com" /INSERT

    and it returns

    Unknown parameter :80:site11.contoso.com

    is it possible to add several hh values using single command?