windows server 2008 iis7备份与恢复

windows server 2008 iis7备份与恢复

最近在部署基于Windows Server 2008平台的Web服务器,发现Appcmd.exe是一个非常实用的命令工具,利用其可实现IIS 7的快速部署。下面笔者实例演示一下Appcmd.exe命令最常用的功能。

1、Appcmd或者AppcmdUI

需要说明一下,在IIS 7种除了Appcmd.exe之外还有一个AppcmdUI.exe命令。其实这两个命令的作用是相同的,只不过第二个是基于图形界面的,大家可根据自己的习惯选择使用。

运行命令提示符工具,输入“CD %systemroot%system32Inetsrv”回车后进入Appcmd.exe所在路径。我们将使用该工具进行IIS7的备份及恢复。

备份 >AppCmd Add Backup “BackupName”

罗列备份 >AppCmd List Backup

恢复 >AppCmd Restore Backup “BackupName”

关于appcmdui.exe

Features
§  Works with both “appcmd <object> <verb>” and “appcmd <verb> <object>” command styles.
§  Shows list of objects and verbs available. Builds auto complete list dynamically so that you see only few options.
§  Builds list of current application pools, sites, applications, virtual directories, backups, module, traces, worker processes and shows them as parameter values. Updates this list when “appcmd add/delete” commands are used.
§  Force update option for tool to pick latest configuration data when “appcmd set config” or other scripts/tools are used to add/delete apppools/sites/apps/vdirs.
§  Parses the schema and shows section names in commands which require section names. Custom defined sections are automatically picked.
§  When working with a particular section, shows list of attributes/elements/collections and helps you setting attributes and adding/removing collection elements.
§  Shows attributes, elements, collections which you can set using “appcmd set apppool|site|app|vdir|module” commands.
§  Shows general appcmd parameters. Uses –parameter for general parameters rather than /parameter to show they are different.
§  Shows possible attributes when “appcmd –text:” used.
§  Can execute command and see the output in the same window.
§  Shows examples of commands you are working with which are in “appcmd <verb> <object> /?” help.
§  Supports auto complete and command execution even when piping commands together.
§  Limited support for identifiers. There is a corresponding /parameter option for most of the identifiers. Uses /parameter:value.
§  NEW – Up-down lets you browse recently executed commands.
§  NEW – If you run the application without sufficient privileges, it shows UAC dialog box for you to grant access.

Installation
You can use AppcmdUI only on machines which has IIS7 and appcmd.exe installed. Download attached AppcmdUIInstall.zip and run self extracting package AppcmdUIInstall.exe. Extract files (AppcmdUI.exe and AppcmdUI.xml) to a folder on your machine and you are done.

How to Use
Run AppcmdUI.exe as elevated (newest version will demand administrator access if needed only if when you don’t run it from command window). Running from an elevated command prompt is not enough because of UAC settings for applications which are not under windows directory. Start typing appcmd commands in the textbox. You will get list of available options as you go along. Use mouse or down/up arrow keys to select any of available options. Auto complete list is updated every time you type space/comma/colon/dot so that you only see few options which are valid in current context and helps you choose only next option. Snapshot below shows list of available objects in appcmd which are shown on typing “appcmd “.

Appcmd Objects

AppcmdUI uses “appcmd <object> <verb>” format. So you see list of available objects after appcmd. If you type “appcmd <verb>” and then space, you will see list of objects which you can use with the verb you typed. If you want to get list of verbs and not objects when you type “appcmd “, you can set <verb> <object> option in the menu as shown below.

Change command style

When you have the <verb> <object> option set, you will see the available verbs after appcmd as shown below.

Appcmd Verbs

Once you have selected verb and object, you will see list of available options which can be used with them.

Parameter Values
When you need the available application pools, sites, applications, virtual directories, backups, traces, worker processes in the command, AppcmdUI shows the values you can use. Next time when you need to start or stop apppools/sites, delete apps/vdirs or inspect traces, you won’t need “appcmd list” command first.
IIS.Net官方下载地址:http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1446

注意:他并不是微软官方开发的,所以还是推荐大家用windows2008系统自身的Appcmd.exe

目前共 0 条评论