You can use the appcmd tool to manage IIS websites. This might be useful if you’re running IIS on a Server Core installation.
Tip
You can also manage Microsoft Management Consoles, including the Internet Information Services (IIS) Manager,shows how to
configure a Server Core installation for remote management. Because many
of the commands are not repeated, it’s often easier to use the GUI
instead of the appcmd tool.
The appcmd
tool is located in the c:\windows\system32\inetsrv folder. Because this
path isn’t included in the path, you have to include it in commands.
For example, to get help for the appcmd, you can use the following command:
C:\>c:\windows\system32\inetsrv\appcmd /?
The basic syntax of the appcmd is
Most objects accept one of the following four commands: list, add,set, and delete. Some objects can also be stopped and started with the stop and start commands. The following table shows the different objects, and the basic syntax used with the list command.
Note
You can get additional help on
any of these topics by combining one of the four commands with one of
the objects in the format of appcmd command object /?.
Using the list Command for Each of the Objects | Comments |
---|
Sites
C:\>c:\windows\system32\inetsrv\appcmd list
site
| Administration of virtual sites |
Applications
C:\>c:\windows\system32\inetsrv\appcmd list
app
| Administration of applications |
Virtual directories
C:\>c:\windows\system32\inetsrv\appcmd list
vdir
| Administration of virtual directories |
apppool
C:\>c:\windows\system32\inetsrv\appcmd list
apppool
| Administration of application pools |
config
C:\>c:\windows\system32\inetsrv\appcmd list
config
| Administration of general configuration sections |
backup
C:\>c:\windows\system32\inetsrv\appcmd list
backup
| Management of server configuration backups |
wp
C:\>c:\windows\system32\inetsrv\appcmd list wp
| Administration of worker processes |
request
C:\>c:\windows\system32\inetsrv\appcmd list
request
| Display of active HTTP requests |
module
C:\>c:\windows\system32\inetsrv\appcmd list
module
| Administration of server modules |
trace
C:\>c:\windows\system32\inetsrv\appcmd list
trace
| Management of server trace logs |
Adding a Site with appcmd
You can also add a site with the appcmd tool.
Adding a Site with appcmd | Comments |
---|
Add a site.
appcmd add site /name:site-name
/bindings:http/port:[host-header]
C:\>c:\windows\system32\inetsrv\
appcmd add site /name:"Success"
/bindings:http/8080
C:\>c:\windows\system32\inetsrv
\appcmd add site /name:"Success2"
/bindings:http/80:success2
| The add site command adds a website. You only need to identify the site name, the port, and a host header if one is used.
The first example creates a site named Success on port 8080. The second example adds a site named Success2 on port 80 with a host header of success2. |
Adding an Application to a Site with add app
Adding an Application with add app | Comments |
---|
Add an application to a site.
appcmd add app /site.name:site-name
/path:/app-name
C:\>c:\windows\system32\inetsrv\appcmd
add app /site.name:"success" /path:/app
| You can add applications to existing websites with the add app command.
The example creates an application named app for the site named success. |
Adding a Virtual Directory with add vdir
Adding a Virtual Directory with add vdir | Comments |
---|
Add a virtual directory to a site.
appcmd add vdir /app.name:"web-
site/app-name" /path:/Web-site-virtual-
path/physicalpath:actual-path
C:\>c:\windows\system32\inetsrv\appcmd
add vdir /app.name:"default web site
/app1" /path:/svdir /physicalpath:g:
/svdir
| You can add virtual directories to existing websites with the add vdir command.
The example adds a virtual directory named svdir to the app1 application in a website named default web site. The actual path to the directory is identified in the /physicalpath switch as g:/svdir.
Figure 1
shows the result of this command. The virtual directory (named svdir)
is added within the Default Web Site. The Advanced Settings of the
virtual directory show the physical path is on g:\svdir (instead of in
the same path as the Default Web Site). |
Starting and Stopping Application Pools with appcmd and appcmd stop
You can start and stop application pools with the appcmd start and appcmd stop commands. The basic syntax is
appcmd start apppool application-name
appcmd stop apppool application-name
For example, if the application pool is named successpool, you can stop and start it with the following commands:
appcmd start apppool successpool
appcmd stop apppool successpool