Add ServerBinding to IIS web site using Wscript
Posted on 2003-03-08
I have now spent 5 hours trying to add extra ServerBindings to an existing IIS web site (Win2K Server, multiple sites, no Active Directory) using script. I can add the first one no problem, but when I try to add more I get all kinds of problems. After much searching I have discovered that I probably need to use the ADSI method PutEx, but it refuses to allow me to append - I can only update (which replaces all existing bindings). ADS_PROPERTY_APPEND and ADS_PROPERTY_DELETE are not listed in IISHELP but are detailed on MSDN. Does anybody know why or how to get round it?
const ADS_PROPERTY_CLEAR = 1
const ADS_PROPERTY_UPDATE = 2
const ADS_PROPERTY_APPEND = 3
const ADS_PROPERTY_DELETE = 4
Set NewWebServer = GetObject("IIS://ServerName/w3svc/1")
NewBindingsArray = Array(0)
NewBindingsArray(0) = ":80:www.domain.com"
NewWebServer.PutEx ADS_PROPERTY_APPEND, "ServerBindings", NewBindingsArray