When it comes to resetting the Machine Policy, there are lots of articles that explain how to do it yet none of them do a very good job of explaining the process plus many of them have conflicting information, especially when it comes to the order in which to trigger the various codes (TriggerSchedule). Let's start with the first thing that everyone seems to agree on and that is resetting the policy on the client using the ResetPolicy Method. There are two ways of resetting the policy:
Value Description
0 The next policy request will be for a full policy instead of the change in policy since the last policy request.
1 The existing policy will be purged completely.
I find using Value=1 does a better job of resetting the machine policy but I find others use 0 in their Right Click Tools. Verdict still out on which one to use.
Next we use the TriggerSchedule Method to perform a couple of Machine Policy Actions just like we have in the ConfigMgr Control Panel applet and RCT's.
There are 3 trigger codes that I consistently find in various scripts and tools but are issued in different orders. They are:
Machine Policy Assignments Request {00000000-0000-0000-0000-000000000021}
Machine Policy Evaluation {00000000-0000-0000-0000-000000000022}
Machine Policy Agent Cleanup {00000000-0000-0000-0000-000000000040}
All of the scripts and RCT's trigger the Machine Policy Assignments Request {00000000-0000-0000-0000-000000000021} before a Machine Policy Evaluation {00000000-0000-0000-0000-000000000022} but the real question is, when to run the Machine Policy Agent Cleanup {00000000-0000-0000-0000-000000000040}? Some scripts and tools do it before the Request and Evaluation while others do it after. One would assume doing the Cleanup at the end but there are some very popular tools like the Recast RCT's and other scripts from MVP's that perform the Cleanup first.
Initiating a machine policy refresh and evaluation...
PSCode Information: 0 : ([wmiclass]'ROOT\ccm:SMS_Client').ResetPolicy(0)
PSCode Information: 0 : ([wmiclass]'ROOT\ccm:SMS_Client').TriggerSchedule('{00000000-0000-0000-0000-000000000040}')
PSCode Information: 0 : ([wmiclass]'ROOT\ccm:SMS_Client').TriggerSchedule('{00000000-0000-0000-0000-000000000021}')
Perhaps the order doesn't matter so I will stop here and wait for others to comment.