次の方法で共有


IIsComputer.Restore (ADSI)

The Restore method restores 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. You should plan for this service interruption when restoring the metabase from a backup.

objIIsComputer.Restore(
  bstrLocation As BSTR,
  lVersion As LONG,
  lFlags As LONG
)

Parameters

  • bstrLocation
    [in] String containing the location. If an empty string is specified, the default backup location will be used.

  • 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] Reserved. Must be zero.

Return Values

This method has no return values.

Remarks

You can use the Restore method with LocalHost in scripts running in a command prompt by using Cscript.exe. For more information, see Windows Script Host topics in the Windows documentation.

ms524558.alert_caution(en-us,VS.90).gifImportant Note:

The metabase backup and restore functionality exists for versioning purposes, not for cross-computer replication. However, you are not necessarily restricted to 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.

Example Code

<%  
  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  
%>  

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

See Also

Concepts

IIsComputer (ADSI)

Using ADSI to Configure IIS