IIS7 new management Tools AppCmd.exe commands use instances to share _win servers

Source: Internet
Author: User
Tags modifier

IIS 7 provides a new command-line tool, Appcmd.exe, that you can use to configure and query objects on a WEB server and return output in 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 the worker processes and requests that are running on the WEB server.

Appcmd.exe provides consistent commands for common query and configuration tasks, reducing the complexity of learning grammars. 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 a WEB server, or to perform more complex tasks. For example, you can accomplish a complex task similar to the following: Stop all sites that have a request running longer than 60 seconds.

The AppCmd.exe tool is located in the directory C:\windows\sytstem32\inetsrv\ directory

When you use the command line to manage IIS 7.0, you need to use the new administrative tools provided by IIS7.0 AppCmd.exe. The AppCmd.exe tool can complete the Web server's entire management work. Using the AppCmd.exe tool, you can finish the work of the calendar through the command prompt, or you can complete the management through the script. Using the AppCmd.exe tool, you can do the following:

1. Add, delete, modify Web sites and application pools

2, stop, start Web site and application pool

3. Observe work process and request information

4, a list of IIS and ASP.net configuration information, and support for the IIS and ASP.net configuration information to modify

The AppCmd.exe tool provides a constant set of commands, with this set of commands, you can perform query operations and accomplish other tasks for supported object types, either by running these commands in section du or by combining commands to combine commands so that you can perform complex tasks and complete complex queries such as tables:

Object Name Describe
Site Managing Virtual Web Sites
App Managing Applications
VDir Managing Virtual Directories
Appool Managing Application Pools
Config Calendar General configuration file
Wp Calendar work Process
Request Managing HTTP Requests
Module Managing Server Modules
Backup Manage Server Configuration Backup
Trace Manage failed request tracking logs

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

Hint: The command is always in front of the object, and the property is always after 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 Deletes an application pool
Start Start Application pool
Stop Stop 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 satisfying certain criteria

Appcmd.exe list app/apppool.name: "DefaultAppPool"

4, list the details of the object

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 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 of 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, monitoring the current request

Appcmd.exe List Request

The request object can use attributes to find specific information, and by using attributes, you can return a Web site, application pool, worker process, URL, and requested information that has elapsed time (in milliseconds) exceeding 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 the worker process

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 backup:

Appcmd.exe List Backup

Restore Backup

When a backup is restored, 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. This allows you to manually stop IIS running at the appropriate time and manually restart IIS

Appcmd.exe restore Backup/back.name: "XXX"/stop:false

Appcmd.exe restore Backup/backup.name: "XXX"

Delete Backup

Appcmd.exe Relete Backup XXX

16, list the server's overall configuration information

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 deletion element by using a 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

Lock

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. With 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 the enabled application pools and save the information in a standard XML file, execute the following command:

Appcmd.exe List Apppool/state:started/xml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.