How To Perform Administration Tasks in IIS from a Command Prompt in Windows 2000


Summary


The following article describes how to perform administrative tasks in Internet Information Services (IIS) from the command prompt. There are several tools that aid in the performance of administrative tasks. In this article, these tasks are categorized into three separate task groups; however, all tasks are performed from a command prompt by a user that is a member of the Administrator group in the DriveLetter:\Inetpub\AdminScripts folder.

Note: To open a command prompt to perform any of the tasks that are described in this article:

  1. Click Start, click Run, type cmd, and then click OK.
  2. Type cd Inetpub\AdminScripts and then press ENTER.

Display Tasks

The two commands that you can use for display tasks are findweb and disptree. Another command that you can use to display relevant fields for a particular administrative node in the tree is dispnode.


Find a Virtual Web Site

To find a virtual Web site, type the following command from a command prompt:

findweb -c MachineName www.DomainName.com

Display an Administrative Tree

To display an administrative tree, you can type either of the following commands from a command prompt:

disptree -a IIS://ComputerName
OR

disptree -a IIS://LocalHost/w3svc -n

Creation Tasks

The two commands that you can use for creation tasks are mkw3site and mkwebdir; however, the adsutil command-line utility contains several commands that are designed to create an in-process application.



Create a Virtual Web Site

To create a virtual Web site, type the following command from a command prompt:

Mkw3site -r RootDirectory DriveLetter:\FolderName -t NewServerName -h HostName www.MyNewWebsite.com

Create a Virtual Web Directory

To create a virtual Web directory, type the following command from a command prompt:

Mkwebdir -c ComputerName -w "WebSiteName" -v DirectoryName,DriveLetter:\FolderName
OR

Mkwebdir -c LocalHost -w "WebSiteName" -v DirectoryName,DriveLetter:\FolderName

Management Tasks

There are several management commands that deal with everything from the starting and stopping of services to the changing of access properties. This article contains step-by-step instructions for only two management commands, but the following information is a complete list of the other commands:

  • chaccess
  • contftp
  • contsrv
  • contweb
  • dispnode
  • disptree
  • findweb
  • mkw3site
  • mkwebdir
  • pauseftp
  • pausesrv
  • pauseweb
  • startftp
  • startsrv
  • startweb
  • stopftp
  • stopsrv
  • stopweb
  • synciwam

Stop a Virtual Site Without Interrupting the Entire Web Service

To stop a virtual site without interrupting the entire Web service, type the following command from a command prompt:

adsutil STOP_SERVER W3SVC/Server#
In this example, for W3SVC/Server#, you could type W3SVC/1 for the default server, or W3SVC/2 for a non-default server.


Start a Virtual Site Without Interrupting the Entire Web Service

To start a virtual site without interrupting the entire Web service, type the following command from a command prompt:

adsutil START_SERVER W3SVC/Server#
In this example, for W3SVC/Server#, you could type W3SVC/1 for the default server, or W3SVC/2 for a non-default server.


Troubleshooting

  • You have to create the folder for the Virtual Web Directory before you create the directory; the process does not create the folder automatically. If you try to create the directory before you create the folder for it, you will receive an error.
  • You can verify all processes that you perform at the command prompt in the Internet Information Services console. If the console is open when you make a change at the command line, click Action, and then click Refresh to view the changes in the console.

References


For additional informationabout IIS administration, click the article numbers below to view the articles in the Microsoft Knowledge Base:

308169 How To Remotely Administer Internet Information Services
284930 Issues Administering IIS 5.0 from IIS 4.0 MMC