Applied to: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1
Administrators often need to check the status and/or properties of their Web sites. To check the status of a Web site, you can use command-line scripting iisweb.vbs (stored in systemroot\system32) to query or list Web sites on remote or local computers.
Important matters
Only members of the Administrators group on the local computer can run scripts and executables. As a security best practice, log on to the computer using an account that is not part of the Administrators group, and then use the runas command to run scripts and executables as an administrator. At the command prompt, type runas/profile/user:mycomputer\administrator cmd, open a command window with administrator privileges, and then type Cscript.exescriptname (including the full path and any parameters of the script).
This topic includes the following information:
• Syntax: The order in which you type the command and any parameters and options that follow it.
• Parameter: Gives the value of the variable in the command.
• Example: Sample code and a description of the result.
Grammar
Iisweb/query [WebSite [WebSite ...]]
[/s Computer [/u [domain\]user/p Password]]
Parameters
WebSite
Restricts the query to the specified Web site. Type the name of the Web site or the configuration database path. All Web sites on the IIS server are displayed by default. 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 name or IP address of the computer 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 runs with the permissions of the current user of the local computer.
/P Password
Specifies the password for the user account specified in the/u parameter.
Note
The query output includes the site name, metabase path and IP address, or "all" to represent all unassigned addresses.
Sample
Example 1:
The following example displays a Web site on the local computer. If you omit the WebSite parameter, you will limit the search to the local computer and the/s parameter will no longer be required. The/U and/P parameters can be ignored because the user who is running the command prompt must be logged on as an administrator on the local computer.
Copy Code code as follows:
In response, IIsWeb displays all IIS Web sites on the local computer, including their site name, metabase path, status, IP address, port, and host name.
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/1211348328) started 172.30.152.249 N/A
Marketing (w3svc/1907510956) started www.contoso.com
Example 2:
The following example searches the Web site "Marketing" on the remote computer SVR01. 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/query marketing/s svr01/u admin6/p a76qvj32#
In response, IIsWeb displays the site "Marketing" on SVR01.
Site Name (Metabase Path) Status IP Port Host
Marketing (w3svc/1907510956) STOPPED www.contoso.com
Example 3:
The following example displays the status of the Web site "Marketing" and "Finance" on the local computer. Although the metabase path is also valid, it uses the site name to identify the Web site.
Copy Code code as follows:
Iisweb/query Marketing Finance
In response, IIsWeb displays the status of the site "Marketing" and "Finance".
Site Name (Metabase Path) Status IP Port Host
Marketing (w3svc/1907510956) started www.contoso.com
Finance (w3svc/1509060625) started 192.168.125.225 www.contosofinance.com