RefreshPolicyEx function

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(
  BOOL  bMachine,
  DWORD dwOptions
);

Parameters

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.

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

   
Windows version Windows Vista 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