IGPMGPO::Import method

Imports the policy settings from the specified GPMBackup object. An import operation transfers the policy settings from a backed-up GPO in the file system to a GPO in the Active Directory. The operation erases any previous policy settings in the destination GPO. The source GPO can be any backed-up GPO in the file system and the destination GPO must be an existing GPO in the Active Directory.


  [in]            long           lFlags,
  [in]            IGPMBackup *pIGPMBackup,
  [in, optional]  VARIANT    *pvarMigrationTable,
  [in, optional]  VARIANT    *pvarGPMProgress,
  [out, optional] VARIANT    *pvarGPMCancel,
  [out]           IGPMResult **ppIGPMResult,
  [in]                       gpmBackup,
  [in, optional]             MigrationTable


lFlags [in]

Specifies the options to use for security principal and path mapping. The following options are defined. For more information, see Copying and Importing GPOs Across Domains.


Map the Security principal and UNC path from the migration table if specified. If there is no entry corresponding to Security principal or UNCPath, keep the setting containing that Security principal or UNC Path as it is. Do not copy security on the GPO and Software Installation Package objects. This is the default value for this parameter.


Map the security principals and UNC paths using the information specified in the migration table only. If a setting is found that cannot be mapped through the migration table, the method fails and returns an error code.

pIGPMBackup [in]

Pointer to the GPMBackup object from which settings should be imported.

pvarMigrationTable [in, optional]

Pointer to a IGPMMigrationTable to use for mapping. This parameter can be NULL.

pvarGPMProgress [in, optional]

Specifies a pointer to an IGPMAsyncProgress interface that allows the client to receive status notifications about the progress of the import operation. This parameter must be NULL if the client should not receive asynchronous notifications.

pvarGPMCancel [out, optional]

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

ppIGPMResult [out]

Address of a pointer to the IGPMResult interface representing the result of the import operation. That interface contains a pointer to an IGPMStatusMsgCollection interface and an IGPMGPO interface.

gpmBackup [in]

GPMBackup object from which settings should be imported.

MigrationTable [in, optional]

Path of a file that contains the migration table to use for mapping.

Return value


Returns S_OK if successful. Returns a failure code if an error occurs.


Returns a reference to a GPMResult object.


Returns a reference to a GPMResult object.


An import operation only transfers policy settings. It erases any existing settings in the GPO. An import does not modify the GPO ID or the ACLs on the destination GPO, nor does it modify any links that point to the destination GPO or to an associated WMI filter.

Note  An import operation is similar but different than a copy operation. For an import operation, the source GPO must be in the file system and the destination must be an existing GPO in Active Directory. For a copy operation, the source GPO must be in the Active Directory and the copy creates a new destination GPO. For more information about copying GPOs, see IGPMGPO::CopyTo.

Note that you must check the code returned by the IGPMResult::OverallStatus method as well as the one returned by this method to determine whether or not 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.

For more information about security groups, see How Security Groups are Used in Access Control in the Active Directory Programmer's Guide.


Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008








IID_IGPMGPO is defined as 58CC4352-1CA3-48E5-9864-1DA4D6E0D60F

See also