Applied to: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2
Iisweb.vbs:IIS Web Site Admin Script
Create, delete, and list Web sites on a server running Windows Server 2003 with Internet Information Services (IIS) 6.0. You can also start, stop, and pause a Web site.
Iisweb.vbs (generally in systemroot\system32) if not available to the cloud habitat community to download.
To view the command syntax, click the following command:
iisweb/create
Iisweb/delete,/start,/stop,/pause
Iisweb/query
Iisweb/create
Create a Web site on a server running Windows Server 2003 with Internet Information Services (IIS) 6.0.
Grammar
Iisweb[.vbs]/create Pathsitename [/b] [/I ipaddress] [/D hostheader] [/dontstart] [/s Computer [/u] [domain\]user [/P Password]]]
Parameters
Path
Required parameters. Specifies the location of the content file for the Web site. The path must be a local path, such as C:\Projects\HTML. If the specified path does not exist, Iisweb.vbs creates the path.
In the command, the Path parameter must be immediately preceding the SiteName parameter. Otherwise, iisweb.vbs will not be able to interpret the site information correctly.
SiteName
Required parameters. Specifies the name of the Web site.
/b Port
Specifies the TCP port number for the Web site. The default value is 80.
/I IPAddress
Specifies the IP address of the Web site. If you do not specify this parameter, the default value is all unassigned, which assigns all IP addresses on computers that are not assigned to other sites to the site. 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, a site does not have a host header name and must be identified with its IP address or port number.
/dontstart
Indicates that the site will not start automatically immediately after it is created. By default, IIS starts the Web site when the/create command completes successfully.
/s Computer
Runs the script on the specified remote computer. Type the computer name or IP address without the backslash. By default, the script runs on the local computer.
/u [domain\]user
Runs the script with the permissions of the specified user account. The account must be a member of the Administrators group on the remote computer. By default, the script is run with the privileges of the current user of the local computer.
/P Password
Specifies the password for the user account specified in the/u parameter. If this argument is omitted, the script prompts you for a password and does not display the text you typed.
/?
Displays help at the command prompt.
Comments
• To perform this procedure, you must be a member of the Administrators group on the local computer, or you must be delegated the appropriate permissions. Members of the domain Admins group may perform this procedure if the computer is already joined to a domain. As the safest operation, consider using run as to perform this procedure.
• In the command, the Path parameter must be immediately preceding the SiteName parameter. Otherwise, iisweb.vbs will not be able to interpret the site information correctly.
DNS must be configured to associate the host header name with an Internet server. Otherwise, the site will not start.
Iisweb.vbs will not verify the port number, IP address, or host header of the Web site, and it does not verify that the bindings are unique within the server. If you create a site with an invalid or conflicting binding, the site will not start.
• When creating a new Web site using iisweb.vbs, specify only the basic attributes required to create a site and identify its content. The default properties used by Iisweb.vbs are the same as the default properties used by IIS when a new Web site is established, and they conform to the rules for inherited properties. To configure more advanced properties for your site, use IIS Manager.
Example
The following example shows how to use iisweb/create in a particular case.
Create a Web site on the local computer
The following command creates my vacation Web site using the files stored in C:\Rome. It uses the/d parameter to specify the host header for the Web site. It also uses the/dontstart parameter so that the Web site does not start automatically. This allows the system to have enough time to add the host header name to DNS before the site is started.
Copy Code code as follows:
Iisweb/create d:\webroot\jb51 "jb51"/d Www.jb51.net/dontstart
In response, Iisweb.vbs will display the basic properties of the new Web site. Because the command specifies that the Web site should not start automatically, the status is stopped.
Note that the metabase path that IIS generates for the new Web site consists of w3svc and randomly generated identifiers.
Connecting to server ... has been completed. Server = iis-test Site Name = My vacations Metabase Path = w3svc/1211348328 IP = All Unassigned Host = www.jb51.net Port = The Root = C:\Rome Status = STOPPED
Create a Web site on a remote computer
The following command creates a Marketing Web site on the SRV01 remote server. It associates the site with a file that is stored in the D:\New initiatives\marketing\htmfiles directory on SRV01. This command uses the/I parameter to specify the IP address of the site. It uses the/s parameter to specify the remote computer, using the/U and/P parameters to run the script with the user's administrator account permissions.
Copy Code code as follows:
Iisweb/create "D:\New initiatives\marketing\htmfiles" marketing/i 172.30.163.244/s srv01/u admin6/p A76QVJ32#
In response, Iisweb.vbs displays the basic properties of the new Web site:
Server = SRV01 Site Name = Marketing Metabase Path = w3svc/1907510956 IP = 172.30.163.244 Host = not SPECIFIED Port = R oot = D:\New Initiatives\marketing\htmfiles Status = Started
Iisweb/delete,/start,/stop,/pause
Remove a Web site from a server running Windows Server 2003 with Internet Information Services (IIS) 6.0. You can also start, stop, and pause a Web site.
Grammar
Iisweb[.vbs] {/delete |/start |/stop |/pause} WebSite [WebSite ...] [/s Computer [/u [domain\]user [/P Password]]]
Parameters
WebSite
Required parameters. Specifies the site name or metabase path of the Web site.
Web sites must be uniquely identified. If more than one Web site has the same descriptive name, you must use the metabase path to identify the Web site.
/s Computer
Runs the script on the specified remote computer. Type the computer name or IP address without the backslash. By default, the script runs on the local computer.
/u [domain\]user
Runs the script with the permissions of the specified user account. The account must be a member of the Administrators group on the remote computer. By default, the script is run with the privileges of the current user of the local computer.
/P Password
Specifies the password for the user account specified in the/u parameter. If this argument is omitted, the script prompts you for a password and does not display the text you typed.
/?
Displays help at the command prompt.
Comments
• To perform this procedure, you must be a member of the Administrators group on the local computer, or you must be delegated the appropriate permissions. Members of the domain Admins group may perform this procedure if the computer is already joined to a domain. As the safest operation, consider using run as to perform this procedure.
Example
The following example shows how to use Iisweb/delete,/start,/stop, and/pause in specific situations.
Delete a Web site
The following command deletes the My novel Web site from the local computer:
Copy Code code as follows:
Iisweb/delete "My I-novel"
In response, Iisweb.vbs displays a success message that identifies the Web site by configuring the database path w3svc/409413479:
Server w3svc/409413479 has been DELETED.
To delete multiple Web sites on a remote computer
The following command deletes the Finance, Work Group, and Logo Web site from the remote server Svr01. The command will identify the logo Web site through its metabase path w3svc/79116006.
Copy Code code as follows:
Iisweb/delete Finance "Work Group" w3svc/79116006/s Svr01
In response, Iisweb.vbs displays a success message that identifies each Web site by configuring the database path:
Copy
Connecting to server ... has been completed. Server w3svc/1977437537 has been DELETED. Server w3svc/1509060625 has been DELETED. Server w3svc/79116006 has been DELETED.
Restart a Web site on a remote computer
The following command stops the Products Web site on the remote computer SRV01 and then starts it. These commands will identify the site by configuring the database path w3svc/1509060225. These commands use the/s parameter to specify the remote computer. In this case, the/U and/P parameters are omitted because the current user of the local computer is also the administrator of the remote computer.
Copy Code code as follows:
Iisweb/stop w3svc/1509060225/s SRV01
Iisweb/start w3svc/1509060225/s SRV01
Pausing and restarting a Web site on a remote computer
The following command pauses the Marketing and Finance Web sites on the remote computer Srv16 and then starts them. This command uses the/s parameter to specify the remote computer, using the/U and/P parameters to run the commands with the privileges of the user Administrator account.
Copy Code code as follows:
Iisweb/pause Marketing finance/s srv16/u alice/p p@# #word
Iisweb/start Marketing finance/s srv16/u alice/p p@# #word
Iisweb/query
displays a Web site on a server running Windows Server 2003 with Internet Information Services (IIS) 6.0.
Grammar
Iisweb[.vbs]/query [WebSite [WebSite ...]] [/s Computer [/u [domain\]user [/P Password]]]
Parameters
WebSite
Restricts the query to the specified Web site. Please type the name of the Web site or the metabase path. The default value is to display all Web sites on the IIS server.
Web sites must be uniquely identified. If more than one Web site has the same descriptive name, you must use the metabase path to identify the Web site.
/s Computer
Runs the script on the specified remote computer. Type the computer name or IP address without the backslash. By default, the script runs on the local computer.
/u [domain\]user
Runs the script with the permissions of the specified user account. The account must be a member of the Administrators group on the remote computer. By default, the script is run with the privileges of the current user of the local computer.
/P Password
Specifies the password for the user account specified in the/u parameter. If this argument is omitted, the script prompts you for a password and does not display the text you typed.
/?
Displays help at the command prompt.
Comments
• To perform this procedure, you must be a member of the Administrators group on the local computer, or you must be delegated the appropriate permissions. Members of the domain Admins group may perform this procedure if the computer is already joined to a domain. As the safest operation, consider using run as to perform this procedure.
Example
The following example shows how to use iisweb/query in a particular case.
Querying a Web site on the local computer
The following command displays the Web site on the local computer:
Iisweb/query
In response, Iisweb.vbs displays all IIS Web sites on the local computer:
Site Name (Metabase Path) Status IP Port Host ======================================================================== ===== Default Web site (W3SVC/1) started all n/A products (w3svc/1948497947) started 172.30.163.244-N/a Finance (w3svc/121134832 8 started 172.30.152.249 N/a Marketing (w3svc/1907510956) started all www.jb51.net
Querying a specific Web site on a remote computer
The following command searches the Marketing Web site on the remote computer Srv01. It uses the/s parameter to specify the remote computer, using the/U and/P parameters to run the script with the privileges of the user Administrator account.
Iisweb/query marketing/s srv01/u admin6/p a76qvj32#
In response, Iisweb.vbs will display the Marketing Web site on SRV01:
Site Name (Metabase Path) Status IP Port Host ======================================================================== ===== Marketing (w3svc/1907510956) STOPPED all www.jb51.net
Querying multiple Web sites
The following command displays the status of the Marketing and Finance Web sites on the local computer. Although the metabase path is also valid, it still uses the site name to identify the Web site.
Iisweb/query Marketing Finance
In response, Iisweb.vbs will display the Marketing and Finance Web sites:
Site Name (Metabase Path) Status IP Port Host ======================================================================== Marketing (w3svc/1907510956) started all www.jb51.net Finance (w3svc/1509060625) started-192.168.125.225-www. Reskit2.com
Comments
Iisweb.vbs can perform the same operations performed through IIS Manager. You can use any of these tools to manage IIS Web sites.
• The computer that issued the command must be running Windows XP or the Windows Server 2003 operating system. The user must be a member of the Administrators group on the computer to which the command affects.
• The computer that the command affects must be a server running Windows Server 2003 with Internet Information Services (IIS) 6.0.
• When connecting to the IIS service on the specified computer, iisweb.vbs will display the "Connecting to Server" message. This message is displayed every time you use iisweb.vbs, either locally or on a remote computer.