Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » Adsi

Create a New Web Site in Windows

You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.

Create a New Web Site in Windows using VBScript, WMI and LDAP

Example(s)

strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2")

Set objWebService = objWMIService.ExecQuery _
    ("Select * From IISWebService")

arrBindings = Array(0)
Set arrBindings(0) = _
    objWMIService.Get("ServerBinding").SpawnInstance_()
arrBindings(0).IP = "192.168.1.1"
arrBindings(0).Port = "8383"
arrBindings(0).Hostname = "atl-ws-01"

For Each objItem in objWebService
    objItem.CreateNewSite "Test Site", arrBindings, _
        "c:\inetpub\wwwroot"
Next