IIS7 all-new management tool appcmd.exe command using instance sharing

Source: Internet
Author: User

IIS 7 provides a new command line tool, Appcmd.exe, which can be used to configure and query objects on the Web server and return the output in text or XML format. The following is an example of a task that can be completed using 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 processes and requests running on the Web server.

Appcmd.exe provides the same command for common query and configuration tasks, reducing the complexity of the learning syntax. For example, you can use the list command to search for information about objects (such as applications), or the add command to create objects (such as sites ).
In addition, you can combine commands to return more complex data related to objects on the Web server or execute more complex tasks. For example, you can complete a complex task like the following: Stop all sites with requests that have been running for more than 60 seconds.

Directory where AppCmd.exe is located: C: \ windows \ sytstem32 \ inetsrv \

When you use the command line to manage IIS 7.0, you can use appcmd.exe, a new management tool provided by iis7.0. The AppCmd.exe tool does not manage all web servers. The appcmd.exe tool can be used to complete the calendar task by running a command line prompt or by running a script. With appcmd.exe, you can do the following:

1. add, delete, and modify web sites and application pools

2. stop and start the web site and application pool

3. Observe the working process and request information

4. The configuration information of IIS and ASP. NET is displayed in a list, and the configuration information of IIS and ASP. NET can be modified.

The AppCmd.exe tool provides a continuous command set that allows you to perform query operations and complete other tasks for supported object types. You can run these commands in steps, you can also combine commands and execute command combinations to execute complex tasks and perform complex queries, such as tables:

Object Name Description
Site Manage virtual websites
App Manage applications
Vdir Manage virtual directories
Appool Manage application pools
Config General configuration file for calendars
Wp Calendar Worker Process
Request Manage http requests
Module Server Management Module
Backup Manage Server Configuration backup
Trace Manage invalid request tracking logs

Commands supported by AppCmd.exe:

Add

Clear

Configure

Delete

Inspect

Install

List

Lock

Migrate

Recycle

Reset

Restore

Search

Set

Start

Stop

Uninstall

Unlock

AppCmd command

Tip: Notify the object to do something.

List application pools
Set to configure the application pool
Add new application pool
Delete application pool
Start application pool
Stop application pool
Recycle reclaim 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 all applications in the XXX application pool

Appcmd.exe list app/text:/apppool. name: XXX

6. List website configuration information

Appcmd.exe list site "default web site"/config

7. Change 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. Delete the application pool

Appcmd.exe delete apppool/apppool. name: "XXX"

10. list details of all application pools

Appcmd.exe list apppool

11. query all applications whose pool status is started

Appcmd.exe list apppools/state: started

12. Close the specified application pool.

Appcmd.exe stop appPool/appPool. name: "XXX"

13. Enable 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. By using properties, it can return a touch running time (in milliseconds) the website, application pool, workflow, URL, and request information that exceeds the preset value. The attributes used by the request object include:

Website ID-based requests

Appcmd.exe list request/site. id: 1

Application pool-based requests

Appcmd.exe list request/apppool.exe: DefaultAppPool

Work Process-based requests

Appcmd.exe list request/wp. name: "1044"

Website name-based requests

Appcmd.exe list request/site. name: "Default web Site"

Requests based on process running 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 a backup is restored, IIS stops running and the server status is overwritten. Once the configuration file is overwritten, IIS restarts. If you do not want IIS to stop running and restart, use/stop: false. In this way, you can 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 overall server configuration information

Appcmd.exe list config

List default Web site configurations

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 execute

Appcmd.exe list config "Defaul Web Site/"/section: system.net/settings

Obtain all available nodes

Appcmd.exe list config-section :?

17. Edit the configuration node Information

Eg1: Enable Global IPv6

Appcmd.exe set config/section: system.net/settings-Latest 6.enabled: "true"

Eg2: IPv6 is enabled in global configuration. Now you need to reference IPv6 in the default web

Appcmd.exe set config "http: // localhost"/section: system.net/settings-setting 6.enabe: "false"

List node sets

Appcmd.exe list config/section: httpErrors

Edit Node Set

Eg: Set the 401 error page to "401. Htm "changed to" defaulterror.htm"

Use the plus sign (+) or a minus sign (-) to add a live deletion element.

Delete status code 503

Appcmd.exe set config/section: httpErrors/-[statusCode = '000000']

Appcmd.exe set config/section: httpErrors/[statusCode = '000000']. path: defaulterror.htm

18. Lock and unlock configurations

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. Use pipelines to transmit XML data

You can use the/xml modifier in the appcmd list to create complex tasks and perform large-scale batch processing. The/xml modifier can be used to export a query result and save it to a file in the standard XML format, so that other command line tools or shell commands can use this XML file. For example, to list all enabled application pools and save information to a standard XML file, run 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.