GetAppliedGPOListW function (userenv.h)

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


  [in]  DWORD                 dwFlags,
  [in]  LPCWSTR               pMachineName,
  [in]  PSID                  pSidUser,
  [in]  GUID                  *pGuidExtension,


[in] dwFlags

A value that specifies the policy type. This parameter can be the following value.


Retrieves information about the computer policy.

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

[in] pMachineName

A 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.

[in] pSidUser

A value that 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. For more information, see Security Identifiers.

[in] pGuidExtension

A value that specifies the GUID of the extension.

[out] ppGPOList

A pointer that receives the list of GPO structures. For more information, see GROUP_POLICY_OBJECT.

Return value

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


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


The userenv.h header defines GetAppliedGPOList as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header userenv.h
Library Userenv.lib
DLL Userenv.dll

See also




Group Policy Functions

Group Policy Overview