Configuring Config Mgr. agents to run inventory on a custom schedule

Agent settings are configured for each site leaving you with a single schedule for all clients. To configure some of the clients to run on an individual schedule you can create a script that trigger the action you want to run e.g. perform a hardware inventory.

  1. So basically you create a collection containing the computers you want to run the action.
  2. Create a package that contains the script.
  3. Create a program that runs the script e.g. crscript.exe hw.vbs
    image
  4. Create an advertisement with a reoccurrence schedule e.g. every 10 minutes (really not recommended).
    image

Script to trigger Hardware inventory

‘ Set the required variables.
actionNameToRun = “Hardware Inventory Collection Cycle”

‘ Create the CPAppletMgr instance.
Dim controlPanelAppletManager
Set controlPanelAppletManager = CreateObject(“CPApplet.CPAppletMgr”)

‘ Get the available ClientActions object.
Dim clientActions
Set clientActions = controlPanelAppletManager.GetClientActions()

‘ Loop through the available client actions. Run the matching client action when it is found.
Dim clientAction
For Each clientAction In clientActions
If clientAction.Name = actionNameToRun Then
clientAction.PerformAction
End If
Next

Script to trigger Software inventory

Sub RunSoftwareInventory()

‘ Set the required variables.
actionNameToRun = “Software Inventory Collection Cycle”

‘ Create the CPAppletMgr instance.
Dim controlPanelAppletManager
Set controlPanelAppletManager = CreateObject(“CPApplet.CPAppletMgr”)

‘ Get the available client actions.
Dim clientActions
Set clientActions = controlPanelAppletManager.GetClientActions()

‘ Loop through the available client actions. Run the matching client action when it is found.
Dim clientAction
For Each clientAction In clientActions
If clientAction.Name = actionNameToRun Then
clientAction.PerformAction
End If
Next
wscript.echo “Ran: ” & actionNameToRun





2 Responses to “Configuring Config Mgr. agents to run inventory on a custom schedule”

  1. M. says:

    This script doesn’t work on Windows 7 clients. Errors out with:
    (6, 1) Microsoft VBScript runtime error: ActiveX component can’t create object: ‘CPApplet.CPAppletMgr’

  2. I like this web site very much, Its a real nice position to read and receive info . “It is impossible for a man to learn what he thinks he already knows.” by Epictetus.

Leave a Reply