Creating Web Sites Using Iisweb.vbs

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1

You can use the command-line script iisweb.vbs, which is stored in systemroot\System32, to create Web site configurations on local or remote computers running a member of the Windows Server 2003 family with IIS 6.0. This command does not create or destroy content, but it sets up the directory structure and some IIS configuration files.

When you use iisweb.vbs to create a new Web site, you specify only the basic properties that are needed to create the site and identify its contents. Iisweb.vbs uses the same default properties that IIS Manager uses when establishing new Web sites, and it adheres to the same rules for inheriting properties. To configure the more advanced properties of the Web site, use IIS Manager.

Important

You must be a member of the Administrators group on the local computer to run scripts and executables. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run your script or executable as an administrator. At a command prompt, type runas /profile /User:MyComputer</STRONG>Administrator cmd to open a command window with administrator rights and then type cscript.exe ScriptName (include the script's full path and any parameters).

This topic includes the following information:

  • Syntax: The order in which you type a command and any arguments and options that follow it.

  • Parameters: The values that are given to variables in the command.

  • Examples: Sample code and an explanation of the results.

Syntax

iisweb /create Path SiteName [/b Port] [/i IPAddress] [/d HostHeader] [/dontstart] [/s Computer [/u [Domain\]User**/p** Password]]

Parameters

Path

Specifies the location of content files for the Web site. The path must be local, such as C:\Projects\HTML. If the specified path does not exist, then iisweb.vbs creates the path.

The Path parameter must immediately precede the SiteName parameter in the command. Otherwise, iisweb.vbs does not interpret the site information correctly.

SiteName

Required. Specifies a name for the Web site.

/b Port

Specifies a TCP port number for the Web site. The default port is 80.

/i IPAddress

Specifies an IP address for the Web site. The default is All Unassigned, which assigns to the site all of the IP addresses on the computer that are not assigned to other sites. Only one site on each IIS server can be set to All Unassigned.

/d HostHeader

Specifies the host header name for the Web site, such as www.microsoft.com. By default, the site does not have a host header name and must be identified by its IP address or port number.

Your DNS server must be configured to associate the host header name with the Internet server. Otherwise, the site will not start.

/dontstart

Indicates that the Web site should not be started automatically as soon as it is created, which is contrary to the IIS default.

/s Computer

Runs the script on the specified remote computer. Type the computer name or IP address without backslashes. By default, the script runs on the local computer.

/u [Domain\]User

Runs the script with the permissions of the specified user account. This account must be a member of the Administrators group on the remote computer. By default, the script runs with the permissions of the current user of the local computer.

/p Password

Specifies the password of the user account that is specified in the /u parameter.

Note

Iisweb.vbs does not verify the port number, IP address, or host header of a Web site, and it does not verify that these bindings are unique within the server. If you create a site with invalid or conflicting bindings, the site will not start.

Examples

Example 1:

The following example creates a single Web site configuration on a local computer. The source files for the "My Vacations" Web site are located in the C:\Rome directory. The command uses the /d parameter to specify a host header for the Web site. It also uses the dontstart parameter so that the Web site is not started automatically, providing time to add the host header name to DNS before starting the site.

iisweb /create C:\Rome "My Vacations" /d www.reskit.com /dontstart

In response, iisweb displays the following message, along with the basic properties of the new Web site. In this example, "Server" represents the machine name where drive C: is found, "Site Name" is the name you assigned to your Web site, "Metabase Path" represents the metabase key assigned by IIS and is analogous to a registry key in the system registry, "IP" is unassigned by default, "Host" is the header name you assigned, "Port" is set to 80 by default, "Root" is the directory where the Web files reside, and "Status" is set to "STOPPED" as directed.

Connecting to server ...Done.

Server = IIS-TEST

Site Name = My Vacations

Metabase Path = W3SVC/1211348328

IP = ALL UNASSIGNED

Host = www.reskit.com

Port = 80

Root = C:\Rome

Status = STOPPED

Example 2:

The following example creates the Marketing Web site configuration on a remote server (SVR01). It associates the site with files stored in the D:\New Initiatives\Marketing\HTMFiles directory on SVR01. The command uses the /i parameter to specify an IP address for the site. It uses the /s parameter to specify the remote computer, and the /u and /p parameters to run the script with the permissions of the user's Administrator account.

iisweb /create C:\New Initiatives\Marketing\HTMFiles "Marketing" /i 172.30.163.244 /s SVR01 /u Admin6 /p A76QVJ32#

In response, iisweb displays the basic properties of the new Web site. In this example, "Server" represents the server machine name, "Site Name" is the name you assigned to your Web site, "Metabase Path" represents the metabase key assigned by IIS and is analogous to a registry key in the system registry, "IP" represents the assigned DNS address, "Host" is unspecified, "Port" is set to 80 by default, "Root" is the directory where the Web files reside, and "Status" is set to "STARTED" by default.

Server = SVR01

Site Name = Marketing

Metabase Path = W3SVC/1907510956

IP = 172.30.163.244

Host = NOT SPECIFIED

Port = 80

Root = C:\New Initiatives\Marketing\HTMFiles

Status = STARTED