You can use the Restore method of the IIsComputer object to restore the metabase from a backup. The restore operation stops all services dependent on IISADMIN, including all servers, until the restore has completed, then restarts all services. Because of this, if you are restoring the metabase by using a script in an ASP page, you must specify a machine name other than the one on which your script is executing. You cannot use LocalHost as the machine name. You should be careful to plan for this service interruption when restoring the metabase from a backup.
IIsComputer.Restore BackupLocation, BackupVersion, BackupFlags
MD_BACKUP_HIGHEST_VERSION | Restore from the highest existing backup version in the specified backup location. |
<%
Dim ComputerObj, ComputerName
'Restore metabase on a different computer.
ComputerName = "MyOtherComputer"
'You can use LocalHost if running under Windows Script Host.
Set ComputerObj = GetObject("IIS://" & ComputerName)
'Restore the highest number version in MyBackups.
ComputerObj.Restore "MyBackups", MD_BACKUP_HIGHEST_VERSION, 0
%>
You can use the Restore method with LocalHost in scripts running in a command window by using Cscript.exe. For more information, see the Windows Script Host material in the Windows documentation.
Important The metabase backup and restore functionality exists for versioning purposes, not for cross-machine replication. A metabase backup must be restored only to the same machine from which it was originally created.
Backup, EnumBackups, DeleteBackup