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.
- So basically you create a collection containing the computers you want to run the action.
- Create a package that contains the script.
- Create a program that runs the script e.g. crscript.exe hw.vbs
- Create an advertisement with a reoccurrence schedule e.g. every 10 minutes (really not recommended).
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
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‛
Just came across this post… M. i guess you are using Win7 64bit?
The reason for the ActiveX error you get is due to your system using the 64bit version of cscript… If you use „C:windowssyswow64cscript.exe hw.vbs‟ instead, it should work.
Recent Blogroll Additions…
[…]usually posts some very interesting stuff like this. If you’re new to this site[…]…