Datasheet
Figure 1-5
AppCmd.exe Command-Line Utility
IIS 7.0 introduces a new command-line utility, AppCmd.exe, which replaces the functionality provided
by the various VBScript command-line utilities included with previous versions.
AppCmd.exe also
expands command-line control to all IIS configuration functions.
Creating a new web site from the command line is as easy as
appcmd.exe add site /name:MyNewSite /id:999 /bindings:”http/*:80:”
/physicalPath:”C:\inetpub\MyNewSite”
This single command line is shorter than the code involved in using the ASP.NET management namespace
or WMI (each of which is described in the following two sections, respectively). The command line is even
quicker than using an editor to enter the new web site directly into the
applicationHost.config file.
One troublesome function in previous versions of IIS was obtaining a valid backup of the configuration
of a single site. Exporting values from the registry or metabase, using Metabase Explorer or other tools,
was possible but messy. And importing that backup into another server was all but impossible.
AppCmd.exe makes a configuration backup a simple command line:
appcmd.exe add backup MyWebSiteBackup
Restoring that backup is as easy as
appcmd.exe restore backup MyWebSiteBackup
Before you make any configuration changes, you should run a quick backup using AppCmd.exe. Every
administrator has at least one horror story about a long weekend spent restoring a configuration just
because a simple change turned out to be not so simple.
21
Chapter 1: Background on IIS and New Features in IIS 7.0
97823c01.qxd:WroxPro 2/4/08 6:47 PM Page 21