From: TroubleMan on 20 Oct 2009 09:37 I am trying to add multiple host headers to a new website I am creating. I am using VBScript and WMI to create the test site. The code below is taken from Microsoft's example of using the IIS WMI provider My question is if I wanted to add another host header how should it be done? Currently I get a "Subscript out of range error" when I try to add to the array. ' Make connections to WMI, to the IIS namespace on MyMachine, and to the WWW service. set locatorObj = CreateObject("Wbemscripting.SWbemLocator") set providerObj = locatorObj.ConnectServer("MyServer", "root/MicrosoftIISv2") set serviceObj = providerObj.Get("IIsWebService='W3SVC'") ' Build binding object, which is a required parameter of the CreateNewSite method. ' Use the SpawnInstance WMI method since we are creating a new instance of an object. Bindings = Array(0) Set Bindings(0) = providerObj.get("ServerBinding").SpawnInstance_() Bindings(0).IP = "" Bindings(0).Port = "80" Bindings(0).Hostname = "host-header-1" Bindings(1).IP = "" <== Added by me Bindings(1).Port = "80" <== Added by me Bindings(1).Hostname = "host-header-2" <== Added by me ' Create the new Web site using the CreateNewSite method of the IIsWebService object. Dim strSiteObjPath strSiteObjPath = serviceObj.CreateNewSite"MyNewSite",Bindings, "D:\Inetpub\VSERVER")
|
Pages: 1 Prev: 85 Opinion Dsiconsolas.com Next: 800A01AD error when creating Schedule.Service object |