Udostępnij za pośrednictwem


Deleting IIS Backup 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 delete the backup IIS configuration of a local or remote computer.

Deleting backup files moves the files from the systemroot\System32\inetsrv\MetaBack directory to the Recycle Bin. It does not affect the files that are in the systemroot\System32\inetsrv\MetaBack\History directory.

Iisback.vbs performs the same delete 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</STRONG>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 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 /delete [/bBackupName] [/v {Integer | HIGHEST_VERSION}] [/s Computer [/u [Domain\]User**/p** Password]]

Parameters

/bBackupName

Required. Specifies the name of the backup copy.

/v {Integer | HIGHEST_VERSION*}*

Required. Specifies the version number of the backup copy.

Integer Specifies the version number of the backup copy.

HIGHEST_VERSION

Indicates the backup copy with the highest version number.

/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 deletes the Svr01Bkp, version 0 backup copy. It uses the /b parameter to specify the Svr01Bkp series and the /v parameter to specify the version number. Both parameters are required to identify the backup copy.

iisback /delete /b Svr01Bkp /v 0

In response, iisback displays the following message, indicating that the backup copy is deleted:

Backup Svr01Bkp version 0 has been DELETED.

Example 2

This example demonstrates the use of a simple batch file command to delete a series of backup copies of the IIS configuration. You can use this command to delete old files from your archive. You can type the command at the command line or save it in a batch file.

For /L %%i in (0, 1, 15) do iisback /delete /b Svr01Bkp /v %%i

This batch command deletes Svr01Bkp versions 1 through 15 by issuing the iisback /delete command fifteen times, once for each version.

For a more practical application, make the backup name and version numbers variable. Or, use a dir or Listing IIS Backup Configurations Using Iisback.vbs command to detect the backup with the lowest version number, and then append a command that deletes the oldest backup copy (lowest version number) to each command to create a new backup copy.