IGPMGPO::Import method (gpmgmt.h)

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.

Syntax

HRESULT Import(
  [in]            long       lFlags,
  [in]            IGPMBackup *pIGPMBackup,
  [in, optional]  VARIANT    *pvarMigrationTable,
  [in, optional]  VARIANT    *pvarGPMProgress,
  [out, optional] VARIANT    *pvarGPMCancel,
  [out]           IGPMResult **ppIGPMResult
);

Parameters

[in] lFlags

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.

0

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.

GPM_MIGRATIONTABLE_ONLY

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.

[in] pIGPMBackup

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

[in, optional] pvarMigrationTable

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

[in, optional] pvarGPMProgress

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.

[out, optional] pvarGPMCancel

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.

[out] ppIGPMResult

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.

Return value

C++

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

JScript

Returns a reference to a GPMResult object.

VB

Returns a reference to a GPMResult object.

Remarks

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.

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header gpmgmt.h
DLL Gpmgmt.dll

See also

IGPMBackup

IGPMGPO

IGPMResult

IGPMStatusMsgCollection