The following example creates a new Web site.
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
' Specify a name and physical path for the new Web site.
SiteName = "SampleSite"
PhysicalPath = "C:\inetpub\wwwroot"
' Create a Bindings object by using the WMI SpawnInstance_ method.
Set SiteBinding = oWebAdmin.Get("BindingElement").SpawnInstance_
SiteBinding.BindingInformation = "*:80:www.SampleSite.com"
SiteBinding.Protocol = "http"
BindingsArray = array(SiteBinding)
' Get the site object definition
Set SiteDefinition = oWebAdmin.Get("Site")
' Pass the required parameters to the Create method on the Site
' definition to create the site.
SiteDefinition.Create SiteName, BindingsArray, PhysicalPath