' This represents the site level node in the metabase. Properties for the site are
' split between this and the "root" virtual directory beneath.
Set objWebSite = GetObject("IIS://ServerName/W3SVC/")
' SiteID is numeric, in IIS 6 it is semi-random. IIS 5 and IIS 7 use incrementing
' IDs. For IIS 6 you'll either need to know this in advance, or need to search
' the metabase for it. The Default Web Site has SiteID 1.
' To get the current ServerBindings you can call the Get method
arrServerBindings = objWebSite.Get("ServerBindings")
' Also accessible with:
arrServerBindings = objWebSite.ServerBindings
' Each Binding string in the array takes the form:
' IPAddress:PortNumber:HostName
strNewServerBinding = "192.168.1.1:80:somesite.domain.com"
' Either extend the current array (declare a new array, with one extra element
' and copy existing entries). Then a simply put the new array into the property:
objWebSite.Put "ServerBindings", arrNewServerBindings
objWebSite.SetInfo
' Or use the ADS_PROPERTY_APPEND to add an entry to the existing array
Const ADS_PROPERTY_APPEND = 3
objWebSite.PutEx ADS_PROPERTY_APPEND, "ServerBindings", Array(strNewServerBinding)
objWebSite.SetInfo
|