GetAppliedGPOList function

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

Syntax


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

Parameters

dwFlags [in]

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 [in]

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 [in]

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 [in]

A value that specifies the GUID of the extension.

ppGPOList [out]

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.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

Userenv.h

Library

Userenv.lib

DLL

Userenv.dll

Unicode and ANSI names

GetAppliedGPOListW (Unicode) and GetAppliedGPOListA (ANSI)

See also

Group Policy Overview
Group Policy Functions
FreeGPOList
GROUP_POLICY_OBJECT
GetGPOList

 

 

Show: