Export (0) Print
Expand All

IGPMDomain::RestoreGPO method

Restores a Group Policy object (GPO) from a GPMBackup object. You can only restore a GPO to the domain in which the GPO was originally created because the operation restores the GPO with its original GPO ID, policy settings, access control lists (ACLs), and links to Windows Management Instrumentation (WMI) filters.

Syntax


HRESULT RestoreGPO(
  [in]                        objGPMBackup,
  [in]             IGPMBackup *pIGPMBackup,
  [in]             long           lDCFlags,
  [in, optional]   VARIANT    *pvarGPMProgress,
  [out, optional]  VARIANT    *pvarGPMCancel,
  [out]            IGPMRESULT **ppIGPMResult
);

Parameters

objGPMBackup [in]

GPMBackup object that corresponds to the GPO to restore.

pIGPMBackup [in]

Pointer to the GPMBackup object to restore.

lDCFlags [in]

Flags to use for validation. If this parameter is set to zero, the method validates the domain controller to determine whether the restore operation can be performed. If you specify GPM_DONOT_VALIDATEDC, the method does not validate the DC. This parameter is ignored for GPOs that do not include software policy settings. For more information about validation, see the "Remarks" section.

pvarGPMProgress [in, optional]

Specifies a pointer to an IGPMAsyncProgress interface that allows the client to receive status notifications about the progress of the restore operation. To receive asynchronous notifications, the caller must create this interface and then pass the interface pointer in this parameter. This parameter must be NULL if the client should not receive asynchronous notifications. The method will run asynchronously if this parameter is not NULL and will run synchronously if NULL.

pvarGPMCancel [out, optional]

Receives a pointer to an IGPMAsyncCancel interface that the client can use to cancel the restore operation. This parameter is not returned if pvarGPMProgress is NULL.

ppIGPMResult [out]

Address of a pointer to the IGPMResult interface that represents the result of the restore operation. That interface contains pointers to an IGPMGPO interface and an IGPMStatusMsgCollection interface.

Return value

C++

Returns S_OK if successful. Returns a failure code if an error occurs. Returns E_OPERATION_NOT_SUPPORTED_ONDC if the current domain controller is not running Windows Server 2003 and the backed-up GPO contains software policy settings.

JScript

Returns a reference to a GPMResult object.

VB

Returns a reference to a GPMResult object.

Remarks

A restore operation returns the contents of a specific GPO to the status it had when the backup was performed. A restore operation does not modify links to the GPO because they are attributes of a scope of management (SOM). A restore operation also does not modify WMI filters. However, because the link to a WMI filter is an attribute of the GPO, the restore operation restores the link to the WMI filter.

You must check the code that is returned by the IGPMResult::OverallStatus method as well as the one returned by this method to determine whether the operation succeeded. OverallStatus returns an overall status code for the operation. If no error occurred during the operation, it returns a success code. Otherwise, it returns a failure code.

As a best practice, we recommend that you validate the DC in a restore operation. When a GPO includes software policy settings, it is preferable to perform the restore operation on a server running Windows Server 2003 to achieve the best client experience. If you set the lDCFlags parameter to zero, the method determines if the GPO includes software policy settings. If the GPO contains software settings, the method searches for a Windows Server 2003-based DC. Restore operations for GPOs that include software policy settings on Windows 2000-based DCs are successful. However, users may sometimes be required to reinstall the client software applications.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Redistributable

GPMC on Windows Server 2003 or Windows XP with SP1

Header

Gpmgmt.h

IDL

Gpmgmt.idl

DLL

Gpmgmt.dll

IID

IID_IGPMDomain is defined as 6B21CC14-5A00-4F44-A738-FEEC8A94C7E3

See also

IGPMAsyncCancel
IGPMAsyncProgress
IGPMBackup
IGPMDomain
IGPMGPO
IGPMResult
IGPMStatusMsgCollection

 

 

Show:
© 2015 Microsoft