Creating and Configuring a Site Programmatically

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

One of the most common tasks for Internet service providers (ISPs) and administrators who manage complex intranet sites hosted on servers running Internet Information Services (IIS) 6.0 is creating and configuring new Web sites and File Transfer Protocol (FTP) sites. Although you can create these sites by using IIS Manager, if you create sites often or create many sites at once, it can be faster and easier to create sites programmatically. For more information about creating Web sites and FTP sites by using IIS Manager, see Configuring Internet Sites and Services.

You can use a combination of scripts and tools to create a batch file that will automate all of the creating and configuring tasks. The steps for creating the batch file are as follows:

  • Set up and configure DNS.

  • Create directories.

  • Add temporary content.

  • Create Web sites.

  • Set up FrontPage® 2002 Server Extensions from Microsoft.

  • Create FTP sites.

  • Set access control lists (ACLs).

  • Include verification and error checking.

The following sections provide details, including sample scripts, for each step of the process for creating a batch file. In the final section, a complete batch file that you can customize for your environment is provided.

Variables

Some of the sample scripts in the following sections contain one or more of the following variables:

%1 =User

%2 = Domain

%3 = .com (extension)

%4 = y or n (indicates whether FrontPage 2002 Server Extensions should be installed)

If you type newsite.bat user domain.com y at a command prompt, after you save the complete batch file in a text editor, each entry becomes a variable in the script. The variable %1 represents User; the variable %2%3 represents Domain.com; and the variable %2 represents Domain.