Note: This article refers to IIS 7 which ships with Windows Server 2008 and IIS 7.5, which ships with Windows Server 2008 R2. When this article talks about working with IIS 7, think IIS 7 or 7.5.
Back in the days of IIS 6, IIS configuration backups and restores had a handy little GUI option that let you backup or restore your entire IIS set-up with ease. Since the introduction of IIS 7 in Windows Server 2008 and Windows Server R2, Microsoft removed the GUI backup / restore option in IIS 7 in favor of a command line backup / restore.
Backing Up IIS 7 Config In The Command Line
To backup the IIS 7 configuration, use the following command in the command line (you’ll need to run the command prompt as an administrator):
appcmd add backup <<Optionally you can name the backup here>>
Note that this backup only backs up the IIS configuration and not the websites. To backup the website, you will have to copy them manually. It also doesn’t backup SSL certificates.
Restoring IIS 7 Config In The Command Line
To restore your backup, in a command prompt that is running as administrator, run the following:
appcmd.exe restore backup <<Name of backup>>
Backing Up IIS 7 Config Via A GUI
Earlier I said that Microsoft removed the GUI backup and restore option in IIS 7, but this doesn’t mean that there isn’t a wany to backup IIS 7 via a GUI 🙂
To backup IIS 7 via the GUI, simply copy the contents of \windows\system32\inetsrv\config to another location. This is your backup. Ok, it’s not strictly a GUI based backup for IIS 7, but it’s not command line.
Restoring IIS 7 Config Via The GUI
To restore the IIS 7 configuration, simply copy your backup files into the \windows\system32\inetsrv\config directory. If you made a change without backing up IIS 7 first, don’t panic! If you are using Windows Server 2008 SP1 or Windows Server 2008 R2, IIS 7 holds up to 10 automated backups that it takes every time you make a change (It checks for changes every 2 minutes). These backups are held in the %systemdrive%\inetpub\history directory.
IIS 7 Backup / Restore Tips And Tricks
Here are a couple of other commands that you might find useful:
- To list the backups available, run appcmd.exe list backup
- To delete backups, run appcmd.exe delete backup <<Name of backup>>