RefreshPolicyEx function (userenv.h)

The RefreshPolicyEx function causes policy to be applied immediately on the computer. The extended function allows you to specify the type of policy refresh to apply.

Syntax

USERENVAPI BOOL RefreshPolicyEx(
  [in] BOOL  bMachine,
  [in] DWORD dwOptions
);

Parameters

[in] bMachine

Specifies whether to refresh the computer policy or user policy. If this value is TRUE, the system refreshes the computer policy. If this value is FALSE, the system refreshes the user policy.

[in] dwOptions

Specifies the type of policy refresh to apply. This parameter can be the following value.

RP_FORCE

Reapply all policies even if no policy change was detected.

Note that if there are any client-side extensions that can be applied at boot or logon time, (for example, an application installation extension), the extensions are re-applied at the next boot or logon, even if no policy change is detected.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If you do not need to specify the dwOptions parameter, you can call the RefreshPolicy function instead.

By default, policy is reapplied every 90 minutes.

Requirements

Requirement Value
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

ProcessGroupPolicy

ProcessGroupPolicyEx

RefreshPolicy