One of the benefits of working at Avanade is the chance to work on some very large, enterprise scale projects. Last year I worked on a platform refresh project for one of Australia's largest commercial organisations - over 30,000 clients and over 1200 infrastructure related servers.

Right now I'm working on one of Australia's largest web application projects - for the front end web tier alone we will have 25 webservers, and 14 servers in our middle application tier. The main backend SQL Server is a Unisys ES7000, and there's a separate SQL Server cluster for the session state database. All up, we'll be deploying over 60 servers not including the other systems we interconnect into.

The downside of working for Avanade is that you often can't publicly disclose many of the projects you work on, or the clients that you work for.

For a large environment it's vital to have a repeatable build process, so that each server can be built (and rebuilt) to a known good state. For this we are using ADS. Today I was working on scripting various configuration options, and ran into a slight issue attempting to script (via ADSI) changes to the ServerBindings property for a website.

Accessing the ServerBindings property directly seems to return an array of arrays (well, in VBScript everything's a variant, but you understand what I'm talking about). However to Put the updated ServerBindings requires an array of strings.

You can use code similar to the following in a VBS/WSH file to update the ServerBindings property:

Sub UpdateServerBindings( _
    WebSiteID, _
    AdditionalBinding _
    )

    ' Note: removed a lot of error checking code for brevity

    Dim objWebApp
    Dim intArraySize
    Dim arrOldBindings
    Dim arrNewBindings

    Set objWebApp = GetObject("IIS://localhost/w3svc/" WebSiteID)

    If isArray(objWebApp.ServerBindings) then

	arrOldBindings = objWebApp.ServerBindings
        intArraySize = UBound(arrOldBindings)
        Redim arrNewBindings(intArraySize + 1)

        For i = 0 to intArraySize
	    arrNewBindings(i) = arrOldBindings(i)
        Next
				
	arrNewBindings(intArraySize + 1) = ":" & AdditionalBinding & ":"

        objWebApp.Put "ServerBindings", (arrNewBindings)
        objWebApp.SetInfo

    End If

End Sub