Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IWbemBackupRestore::Restore method

The IWbemBackupRestore::Restore method deletes the contents of the current repository and restores them with the contents of a previously specified backup.

Because Windows Management Instrumentation (WMI) is the server for this interface and must be stopped to complete this operation successfully, the COM connection is broken if this call is successful.

Syntax


HRESULT Restore(
  [in] LPCWSTR strRestoreFromFile,
  [inlong    lFlags
);

Parameters

strRestoreFromFile [in]

Constant, null-terminated string of 16-bit Unicode characters that contains the file name of the file to be restored. The specified file should point to a file previously created with IWbemBackupRestore::Backup.

lFlags [in]

One of the following flags from the WBEM_BACKUP_RESTORE_FLAGS enumeration.

FlagMeaning
WBEM_FLAG_BACKUP_RESTORE_DEFAULT

Does not shut down active clients; returns an error if there are any.

WBEM_FLAG_BACKUP_RESTORE_FORCE_SHUTDOWN

Shuts down any active clients.

 

Return value

This method returns an HRESULT that indicates the status of the method call. The following table lists the value contained within the HRESULT.

Return codeDescription
WBEM_E_BACKUP_RESTORE_WINMGMT_RUNNING

Occurs when the flag is set to WBEM_FLAG_BACKUP_RESTORE_DEFAULT, and there are active clients.

WBEM_E_INVALID_PARAMETER

One of the arguments is not valid.

WBEM_E_ACCESS_DENIED

User does not have the right to perform this operation. For more information, see Maintaining WMI Security.

S_OK

Method succeeded.

 

Remarks

Windows Server 2003:  The default mode is the same as setting the force-mode flag, which breaks all active connections. This results in remote procedure call (RPC) errors from active COM connections to WMI—until new connections are established.

Examples

The following C++ example shows how to call the IWbemBackupRestore::Restore method.


// The pInt variable is of type IWbemBackupRestore*
pInt->Restore(
        L"c:\\\\winnt\\system32\\wbem\\repository\\back.x",
        WBEM_FLAG_BACKUP_RESTORE_FORCE_SHUTDOWN
      );

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

Wbemcli.h (include Wbemidl.h)

Library

Wbemuuid.lib

DLL

Wbemsvc.dll

 

 

Show:
© 2015 Microsoft