Backing Up IIS Configurations Using Iisback.vbs

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1

You can use the command-line script iisback.vbs, which is stored in systemroot\System32, to create and manage backup copies of the IIS configuration (metabase and schema) of a remote or local computer. Administrators can use this script tool to create a backup copy of their IIS configuration, to restore an IIS configuration from a backup copy, and to list and delete backup copies.

Iisback.vbs performs the same backup and restore operations that are available in IIS Manager. You can use either tool to view and manage backup copies.

Important

You must be a member of the Administrators group on the local computer to run scripts and executables. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run your script or executable as an administrator. At a command prompt, type runas /profile /User:MyComputer\Administrator cmd to open a command window with administrator rights and then type cscript.exe ScriptName (include the script's full path and any parameters).

This topic includes the following information:

  • Overview: Key concepts in understanding the backup and restore procedures.

  • Syntax: The order in which you must type a command and any arguments and options that follow it.

  • Parameters: The values that are given to variables in the command.

  • Examples: Sample code and an explanation of the results.

Overview

Each /backup operation creates two files, an .MDx file to store the metabase and an .SCx file to store the schema, where the x is the version number of the backup copy. IIS and iisback.vbs store backup copy files in the systemroot\System32\inetsrv\MetaBack directory.

The metabase and schema of an IIS configuration include system-specific and session-specific properties. Do not copy or import the metabase or schema of one IIS server to another IIS server without modification. To copy all or part of a metabase configuration from one system to another, use Copying IIS Configurations Using Iiscnfg.vbs.

To prevent unauthorized use of backup copies, you can use IIS 5.1 or IIS 6.0, and iisback.vbs to encrypt the backup copy with a password. The password encrypts the session key which, in turn, encrypts all of the properties for which the secure attribute is set.

You can read an encrypted backup copy (only the session key and secure properties are encrypted) and you can delete the files. However, you cannot use the backup copy in a restore operation unless you provide the encrypting password. Also, you cannot remove the password encryption from a backup copy or change the encrypting password.

If you do not use password encryption, the session key and secure properties are encrypted with a blank password, which prevents you from reading these values but allows any member of the Administrators group to restore the metabase from the backup copy. IIS 5.1 and IIS 6.0 do not support machine key encryption of backup copies.

Syntax

iisback /backup [/b BackupName] [/v {Integer | HIGHEST_VERSION | NEXT_VERSION*}] [/overwrite] [*/e EncryptingPassword] [/s Computer [/u [Domain\]User**/p** Password]]

Parameters

/b BackupName

Specifies the name of the backup copy. The default is SampleBackup.

/v {Integer | NEXT_VERSION | HIGHEST_VERSION}

Specifies the version number of the backup copy. NEXT_VERSION is the default.

Integer Specifies the version number of the backup copy.

NEXT_VERSION

Specifies the highest version number plus 1. NEXT_VERSION isthe default value.

HIGHEST_VERSION

Reuses the highest version number. Because this option replacesa backup copy, the /overwrite parameter is required whenusing this value. This parameter is only valid when previousversions of the file are stored on the computer.

/overwrite

Permits iisback.vbs to replace an exiting backup copy with the newly created backup copy. Without this parameter, commands used to create a backup copy with the same name and version number as an existing backup copy fail.

/e EncryptingPassword

Encrypts the backup copy with the specified backup password. You can use any string as the password.

The /e parameter creates a secure backup by encrypting the session key and secure properties with the specified password. Administrators must provide the password to use the backup in a restore operation.

If you omit this parameter or omit the password argument, then the backup is encrypted with a blank password. As a result, only the secure properties are encrypted and any administrator can use the backup copy to restore the metabase.

/s Computer

Runs the script on the specified remote computer. Type the computer name or IP address without backslashes. The default is the local computer.

/u [Domain\]User

Runs the script with the permissions of the specified user account. This account must be a member of the Administrators group on the remote computer. By default, the script runs with the permissions of the current user of the local computer.

/p Password

Specifies the password of the user account that is specified in the /u parameter.

Examples

Example 1:

The following command creates a new backup copy of the IIS configuration on the local computer. It uses the /b parameter to assign the name ReskitBkp to the file.

iisback /backup /b ReskitBkp

In response, iisback displays the following success message indicating that the backup copy has been created, and that the default version value, NEXT_VERSION, is assigned to the file. Because this is the first backup copy named ReskitBkp, iisback assigns the version number 0 to the backup copy.

Backup ReskitBkp version NEXT_VERSION has been CREATED.

The new backup copy is displayed in the following list of backup copies on the server:

Backup Name Version # Date and Time

ReskitBkp 0 1/9/2001 5:00:04 AM

The ReskitBkp backup copy consists of two files, ReskitBkp.MD0, which contains the metabase and ReskitBkp.SC0, which contains the schema. Both files are stored in the systemroot\System32\inetsrv\MetaBack directory.

Example 2:

The following command creates a backup copy of the IIS configuration on the \\SVR01 remote server. It uses the /s parameter to provide the name of the remote computer, and the /u and /p parameters to run the script with the permissions of the user's Administrator account.

It also includes the /b parameter to assign the file name Svr01Bkp to the backup copy and the /v parameter to specify the version number (15) of the new backup copy. The command uses the /e parameter to encrypt the backup copy with the backup password 7W*48Hv6#.

iisback /backup /s svr01 /u admin21 /p Rrr3Qv7s /b Svr01Bkp /v 15 /e 7W*48Hv6#

In response, iisback displays the following success message:

Backup Svr01Bkp version 15 has been CREATED.

This command created the Svr01Bkp, version 15 backup copy of the \\SVR01 IIS configuration and stored the data in the Svr01Bkp.MD15 and Svr01Bkp.SC15 files in the systemroot\System32\inetsvr\MetaBack directory of the remote computer.

Listing IIS Backup Configurations Using Iisback.vbs shows the backup copies that are stored on the remote server. The backup command created the final entry in the list.

Backup Name Version # Date and Time

AsiaSvr 1 1/8/2001 9:18:25 PM

Svr01Bkp 11 1/3/2001 3:00:42 AM

Svr01Bkp 12 1/4/2001 3:00:12 AM

Svr01Bkp 13 1/5/2001 3:01:00 AM

Svr01Bkp 14 1/6/2001 3:00:00 AM

Svr01Bkp 15 1/9/2001 5:18:04 AM

Although it is not evident from the list, the new backup copy is encrypted and you must provide the backup password, 7W*48Hv6#, in order to use the backup in a restore operation.

Example 3:

The following command replaces the most recent backup copy of the local IIS configuration with a newer backup. You can use this command format to update the backup copy that you maintain for the server.

The command uses the /b parameter to specify the name of the backup copy. It uses the /v HIGHEST_VERSION parameter to direct iisback.vbs to replace the latest version of the backup copy named CurrentBackup, instead of creating a new version. It also uses the /overwrite parameter, which is required with /v HIGHEST_VERSION to permit iisback.vbs to replace an existing backup.

iisback /backup /b CurrentBackup /v HIGHEST_VERSION /overwrite

In response, iisback displays the following success message:

Backup CurrentBackup version 0 has been CREATED.

The command created new versions of the CurrentBackup.md0 and CurrentBackup.sc0 files, which replaced files with the same names.