Welcome to PrajwalDesai.com. This blog has articles on Microsoft Technologies such as SCCM, Azure, Cloud, PowerShell, Security and other technologies.

Initiate client policy retrieval by using script

2 1,963

Initiate client policy retrieval by using script – In this short post we will see how to Initiate client policy retrieval by using script. A Windows Configuration Manager client downloads its client policy on a schedule that you configure as a client setting. However, there might be occasions when you want to manually initiate policy retrieval from the client. For example, in a troubleshooting scenario when you have deployed a software to a collection or when you are testing. You could actually initiate client policy retrieval using the Actions tab on the Configuration Manager client but the script will also help you out. You must be logged onto the client computer with local administrative rights to perform these procedures.

The below script is taken from Technet. Copy the script into a notepad and save the file with filename.vbs extension.

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"
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
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
end if

set oClientActions=nothing
set oCPAppletMgr=nothing


Initiate client policy retrieval by using script

To initiate client policy retrieval by using script, login to the client computer. Run the file using one of the following methods:

a) Navigate to the file by using Windows Explorer, and double-click the script file. Click OK in the Windows Script Host dialog box.

Initiate client policy retrieval by using script

b) Open a command prompt, and type: cscript <pathfilename.vbs>.

Initiate client policy retrieval by using script