GetAppliedGPOListW function (userenv.h)

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

Syntax

USERENVAPI DWORD GetAppliedGPOListW(
  DWORD                 dwFlags,
  LPCWSTR               pMachineName,
  PSID                  pSidUser,
  GUID                  *pGuidExtension,
  PGROUP_POLICY_OBJECTW *ppGPOList
);

Parameters

dwFlags

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

GPO_LIST_FLAG_MACHINE

Retrieves information about the computer policy.

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

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.

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.

pGuidExtension

A value that specifies the GUID of the extension.

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.

Remarks

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

Note

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.

Requirements

   
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

FreeGPOList

GROUP_POLICY_OBJECT

GetGPOList

Group Policy Functions

Group Policy Overview