The IWbemBackupRestoreEx::Restore method deletes the contents of the current repository, and restores with the contents of a specified previous 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.
HRESULT Restore( [in] LPCWSTR strRestoreFromFile, [in] long lFlags );
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 IWbemBackupRestoreEx::Backup.
One of the following flags from the WBEM_BACKUP_RESTORE_FLAGS enumeration.
Does not shut down active clients; returns an error if there are any.
Shuts down any active clients.
This method returns an HRESULT that indicates the status of the method call. The following list lists the value contained within the HRESULT.
Occurs when the flag is set to WBEM_FLAG_BACKUP_RESTORE_DEFAULT and there are still active clients.
One of the arguments is not valid.
User does not have the right to perform this operation. For more information, see Maintaining WMI Security.
The default method is the same as setting the force mode flag, which breaks all active connections. This results in remote procedure call (RPC) errors from the active COM connections into WMI—until connections are established.
The following C++ example shows how to call the IWbemBackupRestoreEx::Restore method.
// The pInt variable is of type IWbemBackupRestoreEx* pInt->Restore( L"c:\\\\winnt\\system32\\wbem\\repository\\back.x", WBEM_FLAG_BACKUP_RESTORE_DEFAULT );
Minimum supported client
Minimum supported server
Windows Server 2008
|Wbemcli.h (include Wbemidl.h)|