IIS 7 provides a new command-line tool, Appcmd.exe, that you can use to configure and query objects on the WEB server and return output in either text or XML format. Here are some examples of tasks that you can accomplish with Appcmd.exe:
• Create and configure sites, applications, application pools, and virtual directories.
• Stop and start the site.
• Start, stop, and recycle application pools.
• View information about worker processes and requests that are running on the WEB server.
Appcmd.exe provides consistent commands for common query and configuration tasks, which reduces the complexity of learning syntax. For example, you can use the List command to search for information about an object, such as an application, or you can use the Add command to create an object, such as a site.
In addition, you can combine commands to return more complex data related to objects on the Web server, or to perform more complex tasks. For example, you can accomplish a complex task like this: Stop all sites that have requests that run for more than 60 seconds.
AppCmd.exe Tool Directory C:\windows\sytstem32\inetsrv\ directory
When you use the command line to administer IIS 7.0, you need to use the new management tools AppCmd.exe provided by IIS7.0. The AppCmd.exe tool can complete the Web server's total non-administration work. With the AppCmd.exe tool, you can either complete the calendar with command-line prompts, or you can complete the management work by scripting. With the AppCmd.exe tool, you can accomplish the following tasks:
1. Add, delete, modify Web sites and application pools
2. Stop, start Web sites and application pools
3. Observe the work process and request information
4. A list of configuration information for IIS and ASP. and support for modifying configuration information for IIS and ASP.
The AppCmd.exe tool provides an all-in-one command set that, with the set of commands, can perform query operations and accomplish other tasks for supported object types, either by running these commands with the section Du, or by combining commands and combining commands to perform complex tasks, such as tables:
Object Name Description site management virtual Web site app management application vdir Management virtual directory appool management application pool Config Calendar Universal profile WP Calendars work process request management HTTP request Module Management Server Module backup Management Server Configuration Backup trace Management failed request trace log
Commands supported by the AppCmd.exe tool:
Add
Clear
Configure
Delete
Inspect
Install
List
Lock
Migrate
Recycle
Reset
Restore
Search
Set
Start
Stop
Uninstall
Unlock
Appcmd command
Tip: The command always precedes the object, and the property is always behind the object, so you can create a structure that resembles a statement in which the Appcmd.exe notifies the object to do something.
List List Application pools
Set Configuration Application Pool
Add New application Pool
Delete Remove application pool
Start starts the application pool
Stop stopping the application pool
Recycle Recycle application pool
1. List all instances of an object
Appcmd.exe List App
2. List unique Object instances
Appcmd.exe list App "Default Web site/"
3. List object instances that meet certain criteria
Appcmd.exe list app/apppool.name: "DefaultAppPool"
4. List Object Details
Appcmd.exe List App "Default Web site/"/text:*
5. List applications for all XXX application pools
Appcmd.exe List App/text:/apppool.name:xxx
6, List the configuration information of the website
Appcmd.exe List Site "Default Web site"/config
7. Replace the application pool
Appcmd.exe Set App "Default Web site/"/applicationpool: "XXX"
8. Add a new application pool
Appcmd.exe add Apppool/name: "XXX"
9. Remove the application pool
Appcmd.exe Delete apppool/apppool.name: "XXX"
10. List all the application pool details
Appcmd.exe List AppPool
11. Query all application pool status started
Appcmd.exe List apppools/state:started
12. Close the specified application pool
Appcmd.exe stop apppool/apppool.name: "XXX"
13. Open the specified application pool
Appcmd.exe start Apppool/apppool.name: "XXX"
14, monitor the current request
Appcmd.exe List Request
The request object can use properties to find specific information, and by using properties, you can return a Web site, application pool, worker process, URL, and requested information that has run time (in milliseconds) that exceeds the preset value. The properties used by the request object include:
Requests based on the site ID
Appcmd.exe List Request/site.id:1
Application pool-based requests
Appcmd.exe List Request/apppool.exe:defaultapppool
Requests based on worker processes
Appcmd.exe list request/wp.name: "1044"
Requests based on the name of the site
Appcmd.exe list request/site.name: "Default Web Site"
Request based on Process run time
Appcmd.exe list request/elapsed: "1000"
15. Site Backup and Recovery
Backup site:
Appcmd.exe Add Backup BackupName
List backups:
Appcmd.exe List Backup
Restore Backup
When you restore a backup, IIS stops running and overrides the state of the server. Once the configuration file is overridden, IIS restarts. If you do not want IIS to stop running and restart, you can use/stop:false. That way, you can manually stop IIS from running at the right time and manually restart IIS
Appcmd.exe restore Backup/back.name: "XXX"/stop:false
Appcmd.exe restore Backup/backup.name: "XXX"
Delete a backup
Appcmd.exe Relete Backup XXX
16. List the overall configuration information of the server
Appcmd.exe List Config
List the configuration of the default Web site
Appcmd.exe list config "Default Web site/"
When you need to display the configuration content of the default Web site, to reduce the display content, you can perform
Appcmd.exe list config "Defaul Web site/"/section:system.net/settings
Get all available nodes
Appcmd.exe list config-section:?
17. Edit Configuration node Information
EG1: Enable global IPV6
Appcmd.exe set config/section:system.net/settings-ipv6.enabled: "True"
EG2: IPV6 is enabled in the global configuration and is now referenced in the default Web IPv6
Appcmd.exe set config "http://localhost"/section:system.net/settings-ipv6.enabe: "false"
List Node Collections
Appcmd.exe List Config/section:httperrors
Edit Node Collection
Eg: the 401 error page has "401". HTM "modified to" defaulterror.htm "
Add a live delete element by using the plus sign (+) or a minus sign (-)
Delete 503 Status code
Appcmd.exe set config/section:httperrors/-[statuscode= ' 503 ']
Appcmd.exe set config/section:httperrors/[statuscode= ' 401 '].path:defaulterror.htm
18. Lock and unlock the configuration
Unlock:
Appcmd.exe unlock config "Default Web site"/section:system.web/authentication
Locking
Appcmd.exe lock Config "Default Web site"/section:system.web/authentication
19. Using pipelines to transfer XML data
You can use the/xml modifier in the Appcmd list to create complex tasks, and you can perform large-scale batch work. Using the/xml modifier, you can export and save the results of a query to a file in a standard XML format so that other command-line tools or shell commands can use the XML file. For example, to list all enabled application pools and save the information to a standard XML file, execute the following command:
Appcmd.exe List Apppool/state:started/xml
[2]windows Server implements IIS backup, restore, view commands via Appcmd (prior to IIS8 version) Source: InternetDate: 2013-12-24iis 7 provides a new command-line tool, Appcmd.exe, that you can use to configure and query objects on the WEB server and return output in either text or XML format.
The IIS Backup Restore command is as follows:
Start-run-cmd
Enter the IIS directory
CD C:\WINDOWS\system32\inetsrv
============================
Backup command
Appcmd add Backup "Back Up name"
File directory After backup in: C:\Windows\System32\inetsrv\backup
===========================================
Restore command
Appcmd restore Backup "Back up name"
===================================================
View Backup
Appcmd List Backup
IIS7 new management Tools AppCmd.exe commands use instance sharing