다음을 통해 공유


Listing Web Sites Using Iisweb.vbs

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

Administrators frequently need to check the status and/or properties of their Web sites. To check the status of your Web site, you can use the command-line script iisweb.vbs, which is stored in systemroot\System32, to query or list Web sites on remote or local computers.

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/query [WebSite [WebSite...]]

[/s Computer [/u [Domain\]User**/p** Password]]

Parameters

WebSite

Limits the query to the specified Web site. Type the name or metabase path of the Web site. The default displays all of the 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 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

The query output includes the site name, metabase path, and the IP address, or All to indicate all unassigned addresses.

Examples

Example 1:

The following example displays the Web sites on the local computer. Omitting the WebSite parameter limits the search to the local computer, eliminating the need for the /s parameter. The /u and /p parameters are omitted because the user running the command prompt must be logged on as an administrator for the local machine.

iisweb /query

In response, iisweb displays all of the IIS Web sites that are on the local computer, including their site names, metabase paths, status, IP addresses, ports, and host names.

Site Name (Metabase Path) Status IP Port Host

Default Web Site (W3SVC/1) STARTED ALL 90 N/A

Products (W3SVC/1948497947) STARTED 172.30.163.244 80 N/A

Finance (W3SVC/1211348328) STARTED 172.30.152.249 80 N/A

Marketing (W3SVC/1907510956) STARTED ALL 95 www.contoso.com

Example 2:

The following example searches for the "Marketing" Web site on the remote computer SVR01. 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 /query Marketing /s SVR01 /u Admin6 /p A76QVJ32#

In response, iisweb displays the "Marketing" Web site on SVR01.

Site Name (Metabase Path) Status IP Port Host

Marketing (W3SVC/1907510956) STOPPED ALL 80 www.contoso.com

Example 3:

The following example displays the status of the "Marketing" and "Finance" Web sites on the local computer. It uses site names to identify the Web sites, although metabase paths are also valid.

iisweb /query Marketing Finance

In response, iisweb displays the status of the "Marketing" and "Finance" Web sites.

Site Name (Metabase Path) Status IP Port Host

Marketing (W3SVC/1907510956) STARTED ALL 80 www.contoso.com

Finance (W3SVC/1509060625) STARTED 192.168.125.225 80 www.contosofinance.com