다음을 통해 공유


IIsComputer.BackupWithPassword (ADSI)

The BackupWithPassword method backs up the metabase to a location you specify by providing a backup location name of up to 100 characters in length. The backup file is encrypted using the password that you specify instead of using the machine key. Multiple metabase backups can be stored in a backup location.

objIIsComputer.BackupWithPassword(
  bstrLocation As BSTR,
  lVersion As LONG,
  lFlags As LONG,
  bstrPassword As BSTR
)

Parameters

  • bstrLocation
    [in] String containing the location. If an empty string is specified, the default backup location will be used. IIS determines the backup storage mechanism, so the backup location name you provide does not necessarily translate to a particular directory, file, or database storage mechanism. Metabase backups are stored as files in the system32\inetsrv\MetaBack directory.

  • lVersion
    [in] Long integer containing the version number to be assigned to the backup. Must be less than or equal to MD_BACKUP_MAX_VERSION (9999). Can be set to MD_BACKUP_NEXT_VERSION (0xffffffff) which automatically selects the next available version number. These constants are defined in the Mddefw.h header file.

  • lFlags
    [in] Long integer containing one or more of the following flags.

    • MD_BACKUP_FORCE_BACKUP (0x00000004) forces the backup to proceed even if the save fails. Only valid if MD_BACKUP_SAVE_FIRST is specified.

    • MD_BACKUP_OVERWRITE (0x00000001) backs up the metabase even if a backup with the same name and version already exists, overwriting the existing files.

    • MD_BACKUP_SAVE_FIRST (0x00000002) saves the metabase prior to making the backup. Specify MD_BACKUP_FORCE_BACKUP if you want the backup to proceed even if the save fails.

    These constants are defined in the Mddefw.h header file.

  • bstrPassword
    [in] Optional string that will be used to encrypt the backup. This password must be the same as the one used when the IIsComputer.RestoreWithPassword (ADSI) method is invoked.

Return Values

This method has no return values.

Example Code

<%  
  Dim ComputerObj, iFlags  
  Set ComputerObj = GetObject("IIS://LocalHost")  
  'Backup to next available version number.  
  'Set flags to save the metabase first and  
  'force the backup even if save fails.  
  iFlags = (MD_BACKUP_SAVE_FIRST or MD_BACKUP_FORCE_BACKUP)  
  ComputerObj.BackupWithPassword "MyBackups", MD_BACKUP_NEXT_VERSION, iFlags, "MyP@ssWOrd"  
%>  

Requirements

Client: Requires Windows XP Professional.

Server: Requires Windows Server 2003.

Product: IIS

See Also

Concepts

IIsComputer (ADSI)

Using ADSI to Configure IIS

Backing Up and Restoring the IIS Metabase