IIS7入门之旅:(1)appcmd命令的使用

在IIS7中,增加了一个非常有用的基于命令行方式的通用IIS的管理工具,叫做appcmd。利用该cmd可以完成applicationhost.config的backup, restore等等工作,功能非常强大。

以下是appcmd.exe的usage:

 1 
 2  General purpose IIS command line administration tool.
 3 
 4  APPCMD (command) ( object - type)  < identifier >   </ parameter1:value1  >
 5 
 6  Supported  object  types:
 7 
 8    SITE      Administration of  virtual  sites
 9    APP       Administration of applications
10    VDIR      Administration of  virtual  directories
11    APPPOOL   Administration of application pools
12    CONFIG    Administration of general configuration sections
13    WP        Administration of worker processes
14    REQUEST   Administration of HTTP requests
15    MODULE    Administration of server modules
16    BACKUP    Administration of server configuration backups
17    TRACE     Working with failed request trace logs
18 
19  (To list commands supported by each  object  use  /? , e.g.  ' appcmd.exe site /? ' )
20 
21  General parameters:
22 
23  /?                Display context - sensitive help message.
24 
25  / text < :value >     Generate output  in  text format ( default ).
26                    / text: *  shows all  object  properties  in  detail view.
27                    / text: < attribute >  shows the value of the specified
28                   attribute  for  each  object .
29  / xml             Generate output  in  XML format.
30                   Use  this  to produce output that can be sent to another
31                   command running  in   / in  mode.
32  / in  or  -          Read and operate on XML input from standard input.
33                   Use  this  to operate on input produced by another
34                   command running  in   / xml mode.
35  / config < : *>       Show configuration  for  displayed objects.
36                    / config: *  also includes inherited configuration.
37  / metadata        Show configuration metadata when displaying configuration.
38 
39  / commit          Set config path  where  configuration changes are saved.
40                   Can specify either a specific configuration path,  " site " ,
41                    " app " " parent " , or  " url "  to save to the appropriate portion
42                   of the path being edited by the command,  " apphost " " webroot " ,
43                   or  " machine "   for  the corresponding configuration level.
44  / debug           Show debugging information  for  command execution.
45 
46  Use  " ! "  to escape parameters that have same names  as  the general parameters,
47  like  " /!debug:value "  to  set  a config property named  " debug " .
48 

 

该命令支持的对象上表已经列出,包括:

1.Site,

其supported cmd包括:

 1 
 2  C:\Windows\System32\inetsrv > appcmd site  /?
 3  Administration of  virtual  sites
 4 
 5  APPCMD (command) SITE  < identifier >   <- parameter1:value1  >
 6 
 7  Supported commands:
 8 
 9    list      List  virtual  sites
10     set        Configure  virtual  site
11    add       Add  new   virtual  site
12    delete    Delete  virtual  site
13    start     Start  virtual  site
14    stop      Stop  virtual  site
15 
16  (To  get  help  for  each command use  /? , e.g.  ' appcmd.exe add site /? ' .)
17 
18 

 

2. App

 1 
 2  C:\Windows\System32\inetsrv > appcmd app  /?
 3  Administration of applications
 4 
 5  APPCMD (command) APP  < identifier >   <- parameter1:value1  >
 6 
 7  Supported commands:
 8 
 9    list      List applications
10     set        Configure application
11    add       Add  new  application
12    delete    Delete application
13 
14  (To  get  help  for  each command use  /? , e.g.  ' appcmd.exe add site /? ' .)
15 

3. Request

 1 
 2  C:\Windows\System32\inetsrv > appcmd request  /?
 3  Administration of HTTP requests
 4 
 5  APPCMD (command) REQUEST  < identifier >   <- parameter1:value1  >
 6 
 7  Supported commands:
 8 
 9    list      List active HTTP requests
10 
11  (To  get  help  for  each command use  /? , e.g.  ' appcmd.exe add site /? ' .)
12 
13 

4 BackUp

 1  C:\Windows\System32\inetsrv > appcmd backup  /?
 2  Administration of server configuration backups
 3 
 4  APPCMD (command) BACKUP  < identifier >   <- parameter1:value1  >
 5 
 6  Supported commands:
 7 
 8    list      List existing configuration backups
 9    add       Create a configuration backup
10    delete    Delete a configuration backup
11    restore   Restore a configuration backup
12 
13 

 e.g 将iis server的相关配置backup为cleaninstall,然后将该cleaninstall重新装载

appcmd add backup cleaninstall        //create a backup named as "cleaninstall"

appcmd restore backup cleaninstall  //restore the specific backup "cleaninstall"

 

还有其他supported object,每个supported object都有其supported cmd,在此不一一列举了。

你可能感兴趣的:(IIS)