Backup/Restore via the command line
Backing up IIS7 configuration is as simple as copying the \windows\system32\inetsrv\config directory (and subdirectories) into a backup directory, so you don't need anything special to do it. Just include this directory in whatever your OS/content back-up plan is, or write a custom script to do it.
To help make managing backups easy, we've added a simple cmd-line option to AppCmd.exe that makes management of backup/restore sets easy. For example, to backup configuration, run the follow command:
> %windir%\system32\inetsrv\appcmd.exe add backup "My Backup Name"
to restore that backup, run this command:
> %windir%\system32\inetsrv\appcmd.exe restore backup "My Backup Name"
to delete a backup, run this command:
> %windir%\system32\inetsrv\appcmd.exe delete backup "My Backup Name"
Pretty easy, eh? Except for the dirty little secret everyone knows...remembering to do a backup! Thankfully, IIS7 comes to the rescue here. Thanks to a feature called IIS7 configuration history, IIS will automatically make history snapshots of ApplicationHost.config each time a change is detected, enabling you to easily restore to a prior version. By default, IIS checks for a new version every 2 mins, and will keep 10 prior versions of the file. IIS7 stores these snapshots in the %systemdrive%\inetpub\history folder by default. You can change any of these settings by editing the <system.applicationHost/configHistory> section in ApplicationHost.config.
IMPORTANT NOTE: This feature only appears in Windows Server 2008 and Vista SP1. It is not in original release version of Vista , as it was not yet finished when Vista first shipped. This is one of the thousands of changes that was made to IIS7 after Vista RTM, and is one of many reasons you should install SP1 as soon as possible!
How do you restore a prior snapshot? Well, you could just go to the \inetpub\history\cfgHistory_NNNNNNNNNN directory and copy the applicationHost.config file into it's proper place: \windows\sytem32\inetsrv\config. Or you can use the same command as above for restoring a backup to restore a configuration history file.
To enumerate a list of backups and configuration history files, use the following command:
> %windir%\system32\inetsrv\appcmd.exe list backup
الأحد، 26 أكتوبر 2008
الاشتراك في:
تعليقات الرسالة (Atom)
ليست هناك تعليقات:
إرسال تعليق