Platform SDK: Group Policy

GetAppliedGPOList

The GetAppliedGPOList function retrieves the list of GPOs applied for the specified user or computer.

BOOL GetAppliedGPOList(
  DWORD dwFlags,
  LPCTSTR pMachineName,
  PSID pSidUser, 
  GUID *pGuidExtension,
  PGROUP_POLICY_OBJECT *ppGPOList
);

Parameters

dwFlags
[in] Specifies the policy type. This parameter can be the following value.
Value Meaning
GPO_LIST_FLAG_MACHINE Retrieves only computer policy information.

If this value is not specified, the function retrieves only user policy information.

pMachineName
[in] Pointer to the name of the remote computer. The format of the name is \\computer_name. If this parameter is NULL, the local computer name is used.
pSidUser
[in] Specifies the SID of the user. If pMachineName is not NULL and dwFlags specifies user policy, then pSidUser cannot be NULL.

If pMachineName is NULL and pSidUser is NULL, the user is the currently logged-on user. If pMachineName is NULL and pSidUser is not NULL, the user is represented by pSidUser on the local computer.

pGuidExtension
[in] Specifies the GUID of the extension.
ppGPOList
[out] Pointer that receives the list of GPO structures. For more information, see GROUP_POLICY_OBJECT.

Return Values

If the function succeeds, the return value is ERROR_SUCCESS. Otherwise, the function returns a Win32 error code. For a complete list of error codes, see Error Codes or the header file WinError.h.

Remarks

To free the list when you have finished processing it, call the FreeGPOList function.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Userenv.h.
  Library: Use Userenv.lib.

See Also

Group Policy Overview, Group Policy Functions, FreeGPOList, GROUP_POLICY_OBJECT