Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Create website with multiple host headers

Reply
 
Old 10-20-2009   #1 (permalink)
TroubleMan


 
 

Create website with multiple host headers

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")


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Host Public Website on SBS 2008 Network SBS Server
Website access among host and VPC Virtual PC
local website access between in XP host and VPC Virtual PC
create email headers using Windows Mail in Vista Vista mail
Read-Host issue, won't store to variable when using multiple read-host lines PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46