Even if you aren’t a Web admin, it is important to know how to perform IIS backups. Microsoft server products such
as Exchange Server and SharePoint are built on top of Internet Information Services (IIS), and many third-party product vendors use IIS as a mechanism for hosting Web interfaces. As such, backup administrators need to know how to protect IIS and how to recover all or some of the hosted sites.
IIS backup: What you need to back up
To protect IIS, there are three main components that you’ll need to back up. First, you need to back up the underlying website code. This is the HTML, ASP.net or other web code that is rendered when someone accesses a site that is hosted by the Web server.
The second thing that you need to backup is the IIS configuration. In IIS 6, configuration information was stored within the metabase. In IIS 7, Microsoft has begun storing IIS configuration information in XML format instead. I will discuss the XML configuration files later on.
The third item that needs to be backed up is the database. Not all websites make use of a database, but most sites store various types of data in a back-end database. For the purposes of protecting IIS, it is important to know which sites make use of databases and the locations of those databases.
Protecting web site files
There isn’t much to worry about in order to protect the files that make up the individual websites. Typically, each site hosted by your IIS server will be configured to store the files for each site inside a dedicated folder on the server's hard drive. HTML files, ASP.net files and other components used by websites are relatively static. As such, a file-level backup is usually sufficient for backing up website code.
Protecting the database
Not all websites make use of a backend database, but IIS servers hosting database enabled sites typically use Microsoft SQL Server. If your IIS server contains a SQL Server, for instance, or if it connects to a dedicated back-end SQL Server, you can back up the SQL databases just as you would back up any other SQL database. Windows Server Backup has the ability to create VSS backups of SQL Server, as do most third-party backup applications.
Protecting the IIS Configuration
As you can see, protecting the website files and any back-end databases is fairly straightforward. To protect the IIS 7 configuration, however, you need to be familiar with the underlying configuration architecture. There are three main files that Microsoft uses to store IIS configuration information:
- ApplicationHost.config stores the settings for your websites and Web applications.
- Administration.config stores the IIS management settings. Specifically, this file contains a list of the management modules used by the IIS Manager and any module specific configuration settings.
- Redirection.config is designed for use in environments in which consistent configuration settings need to be maintained across multiple IIS servers. This file is designed to show IIS where a centralized collection of configuration files is stored.
These configuration files are stored in the server’s \Windows\System32\inetsrv\config folder. Because all of the configuration files are XML-based, there isn't anything special that you have to do in order to back up the IIS configuration aside from adding this folder and any subfolders to your backup.
Having said that, it is worth noting that IIS contains a mechanism that allows you to create configuration backups independently of your regular backup software. These backups are based on a built-in utility called Appcmd. You can find the Appcmd utility in the server’s \Windows\System32\inetsrv folder. If you want to use Appcmd to back up your configuration then navigate to the \Windows\System32\inetsrv folder and run the following command:
Appcmd add backup “<your backup name>”
If you want to restore the backup, you can do so with this command:
Appcmd restore backup “<your backup name>”
It is also worth noting that IIS 7 creates some backups automatically. Every two minutes, IIS checks to see if the configuration has been modified. If the configuration has changed then IIS creates a snapshot of the new configuration. IIS stores up to 10 configuration snapshots, which makes it possible to roll back the server to an earlier configuration.
All of the configuration snapshots are stored in the \Windows\System32\Inetpub\history folder. If you want to restore a snapshot, just go into the subfolder for the snapshot that you want to restore and then copy the ApplicationHost.config file from the snapshot folder (which is named cfgHistory_NNNNNNNN) to the \Windows\System32\inetsrv\config folder.
IIS backup is relatively easy compared with other applications. Even so, it is important to make sure that you cover all your bases by backing up the website files, configuration data and any backend databases that the sites may use.
About the author: Brien M. Posey, MCSE, has previously received Microsoft's MVP award for Exchange Server, Windows Server and Internet Information Server (IIS). Brien has served as CIO for a nationwide chain of hospitals and has been responsible for the Department of Information Management at Fort Knox. You can visit Brien's personal website at www.brienposey.com.