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





4 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.

  3. Genaro Diver says:

    This may not be the ideal place to inquire about this, but I am trying to find a pest control company in the pittsburgh area and have no way to find out who is the best. I located this business which is truly close to me and wished to see if any individual has any assessments on them. Spectrum Pest Control, 3058 West Liberty Avenue, Dormont, PA 15216 – (412) 446-2802

  4. Gudrun Ohara says:

    This might not be the most beneficial place to ask this, but I’m trying to find a pest control business inside the pittsburgh region and have no method to find out who is the most effective. I discovered this company that’s definitely close to me and wanted to see if anybody has any critiques on them. Spectrum Pest Control, 3058 West Liberty Avenue, Dormont, PA 15216 – (412) 446-2802

Leave a Reply