Posted on November 11, 2016 · Posted in Windows Server 2012 R2

How To Backup and Restore IIS configuration to Another Server

This article describes how to create the backup of IIS Web site, application pool and configuraion and restore them on another server. This guide will help you to create your own plan of emergency recovery for IIS-based websites, migrate the configuration and websites between the servers or add a new server to the web farm.

Backup of website data and configuration running on the Internet Information Service web server consists of several steps:

  1. Backup of website files (by default, they are stored in %SystemDrive%\inetpub\wwwroot). This directory must be included to the backup plan to create its copy using backup tools or your own scripts
  2. Backup (export) of current IIS certificates (you can get the list of SSL certificates on the server using this command: netsh http show sslcert)
  3. Backup of IIS configuration (settings)

We’ll show how to create a backup of IIS configuration on one server and restore it on another one.

Using appcmd, create IIS configuration backup on first server. To do it, run the command prompt with the administrator privileges and go to the following directory:

cd c:\Windows\system32\inetsrv

Create the IIS configuration backup with name srviis1-backup-20161107:
appcmd add backup srviis1-backup-20161107

appcmd - backup  iis site config

After the command has been executed, a folder with your backup name appears in c:\Windows\system32\inetsrv\backup. Here is its contents for my simple website:

  • administration.config
  • applicationHost.config
  • MBSchema.xml
  • MetaBase.xml
  • redirection.config

iis config files

Copy the backup folder to the same directory c:\windows\system32\backup on another server.

To display the list of all available backups, run the following command:

appcmd list backup

As we can see, the backup we have copied has appeared in the list of available backups.

Recover IIS configuration from this backup:
appcmd restore backup srviis1-backup-20161107

appcmd restore iis from backup

The string Restored configuration from backup «srviis1-backup-20161107″  means that IIS configuration has been successfully recovered.

Note. There are entries like BACKUP “CFGHISTORY_0000000001″ in the list of available backups. These are IIS configuration backups created automatically and located in \inetpub\history. Automatic backup has appeared in IIS since IIS 7: the changes in ApplicationHost.config are being monitored, 10 latest backups are stored and the file is checked for changes every 2 minutes.

The list of restrictions and important issues.

  • The same IIS version has to be used on both servers
  • If any application pool is run not from the integrated accounts, they have to be available on another server as well
  • Before recovery, you should export and migrate all current certificates to the new server

 

Previous:
Next:
Related Articles