IIsComputer.BackupWithPassword (ADSI)
You can use the BackupWithPassword method of the IIsComputer (ADSI) object to back up the metabase to a location you specify by providing a backup location name of up to 100 characters in length and a password valid for the targeted computer. Multiple metabase backups can be stored in a backup location.
Syntax
IIsComputer.BackupWithPassword BackupLocation, BackupVersion, BackupFlags, BackupPassword
Parameters
BackupLocation
A string of up to 100 characters that specifies the backup location. The storage mechanism will be determined by IIS. If an empty string is specified, the backup will be stored in the default location.
BackupVersion
Specifies the version number to be assigned to the backup. Must be less than or equal to MD_BACKUP_MAX_VERSION. Can be set to one of the following values.
MD_BACKUP_HIGHEST_VERSION | Overwrite the highest existing backup version in the specified backup location. |
MD_BACKUP_NEXT_VERSION | Use the next backup version number available in the specified backup location. |
BackupFlags
One or more of the following flags.
MD_BACKUP_FORCE_BACKUP | Force the backup even if the SaveData operation specified by MD_BACKUP_SAVE_FIRST fails. |
MD_BACKUP_OVERWRITE | Back up even if a backup of the same name and version exists in the specified backup location, overwriting if necessary. |
MD_BACKUP_SAVE_FIRST | Perform a SaveData operation before the backup. Default if no flags are specified. |
BackupPassword
Optional. Unencrypted valid password.
Remarks
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.
Important The metabase backup and restore functionality exists for versioning purposes, not for cross-machine replication. However, you are not necessarily restricted to backing up and restoring the computer from which you initiate the process. For more information about restoring from a back up, see Backing Up and Restoring the IIS Metabase.
Code Example
<%
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"
%>
Related Topics
- For information on other methods in the IIsComputer object, see IIsComputer (ADSI).