Note: Not too worried about the complexity of this command - AppCmd.exe is easy to use. We will show you how to use it.
The basic commands used with AppCmd.exe are start, stop, list, add, delete, and set . Typically each of these commands will be used with an object type that you will require AppCmd.exe to perform its desired function.
The types of objects here are:
Site - IIS virtual site
App - IIS application
Vdir - IIS virtual directory
Apppool - IIS application pool
Config - IIS general configuration
Backup - IIS server configuration backups (you can also use the restore command)
Wp - IIS worker processes
Request - active HTTP requests
Modules - IIS server administration modules
Trace - IIS server trace logs
As you can see, there are many things you can do with AppCmd.exe, but it is not that difficult if you use help.
Use AppCmd.exe easily with help
We said that AppCmd.exe /?It will allow you to get help on AppCmd.exe. You can get information about object types by typing appcmd (object) /?
Here is an example:
Configure IIS 7 from the command line using Appcmd.exe - Part 1 Picture 1
Figure 1: Get help information for an AppCmd.exe object type
You can also get more help information for different commands on each and every type of object. This means that there is a lot of help here for you. With 10 different object types and at least 3+ commands for each type (list, add and delete are regular commands), there are more than 30 different help files available. Here's an example of how to use help, which helps us know what can be done with the add command and the vdir command together:
Configure IIS 7 from the command line using Appcmd.exe - Part 1 Picture 2
Figure 2: Get help information with AppCmd.exe add and vdir options
If using help '/?' and listing step-by-step commands will give you instructions on how to perform any tasks you want to perform with AppCmd.exe.
5 ways you can use AppCmd.exe to make IIS website administration tasks easy
Ensure that everything can be done in the IIS management MMC (GUI) can be done with AppCmd.exe at the command prompt, but the GUI interfaces also have its drawbacks. To put a few names - with the GUI you cannot perform repetitive tasks (like a Windows Desktop Shortcut) nor can you use the output from an AppCmd.exe output and send it to an AppCmd Action.
Here are 5 ways to use AppCmd.exe to make your IIS website administration task easier:
1. Start and Stop IIS websites from the command line
This is indeed a simple task if you don't know your site's name, just do it:
Appcmd list sites
Configure IIS 7 from the command line using Appcmd.exe - Part 1 Picture 3
Figure 3: List sites using AppCmd.exe
Now you will know what sites you have and can start or stop IIS web sites as follows:
Appcmd start sites 'Default Web Site' (or any site you want to start)
Configure IIS 7 from the command line using Appcmd.exe - Part 1 Picture 4
Configure IIS 7 from the command line using Appcmd.exe - Part 1 Picture 5
Figure 5: Adding a website with AppCmd
This way only adds a new website, that website may not be as complete as a site added in the GUI unless all command options are added then an application is added to it. To get the full functionality of the IIS site, use the following command:
Using the listed command is easy. We showed you how to list your website running on the server in way 1 above. Note in the output that you can see that the site may be running or not running (the status of the sites). You can list all objects (like site) with certain information. For example, this command will list all sites that are stopped. Here is an example of how to do it:
Configure IIS 7 from the command line using Appcmd.exe - Part 1 Picture 6
Figure 6: Shows all IIS websites that have a certain status
4. Backup IIS configuration
AppCmd.exe can backup IIS configuration using the add backup command . You can also list your commands using the list backup and restore backup commands that can bring the backup data back to where it is needed with the command.
Below you can see that we have backed up our IIS configuration and then list what backups are available after that.
Configure IIS 7 from the command line using Appcmd.exe - Part 1 Picture 7
Figure 7: Backup the IIS configuration
5. Report on IIS configuration
AppCmd has the power to report IIS configurations and export the configuration to a text file. To do that, simply run:
Appcmd list site 'sitename' / config
This is what the output of the implementation process:
Configure IIS 7 from the command line using Appcmd.exe - Part 1 Picture 8
Figure 8: List IIS website configuration
Conclude
AppCmd.exe is indeed a command line tool for useful for IIS 7.x. AppCmd.exe can say that all IIS website configuration tasks can be done from the command line. It is a powerful support for Windows / IIS web administrators to know how to use it correctly to quickly perform common IIS tasks. In this article, you not only know what AppCmd.exe is but also know all that it can do for you in this way.