SCCM 2007 Machine Policy Retrieval & Evaluation Cycle VBScript

When you make any changes to your SCCM 2007 environment, the clients will polling for this changes by a interval. Default this is 60 minutes. If you want to force an Machine Policy Retrieval, you can use to following two options:

1.) Open your control panel
2.) Configuration Manager
3.) Action tab
4.) Machine Policy Retrieval & Evaluation Cycle
5.) Initiate Action

The next option is to use the following script.
———————————————————————————————
on error resume next

dim oCPAppletMgr ‘Control Applet manager object.
dim oClientAction ‘Individual client action.
dim oClientActions ‘A collection of client actions.

‘Get the Control Panel manager object.
set  oCPAppletMgr=CreateObject("CPApplet.CPAppletMgr")
if err.number <> 0 then
    Wscript.echo "Couldn’t create control panel application manager"
    WScript.Quit
end if

‘Get a collection of actions.
set oClientActions=oCPAppletMgr.GetClientActions
if err.number<>0 then
    wscript.echo "Couldn’t get the client actions"
    set oCPAppletMgr=nothing
    WScript.Quit
end if

‘Display each client action name and perform it.
For Each oClientAction In oClientActions

    if oClientAction.Name = "Request & Evaluate Machine Policy" then
        wscript.echo "Performing action " + oClientAction.Name
        oClientAction.PerformAction
    end if
next

set oClientActions=nothing
set oCPAppletMgr=nothing
———————————————————————————————

Leave a Reply