Queue Script
Summary
This script will schedule a script to run on a computer the next time it checks in.
Sample Run

Dependencies
- CWM - Automate - Solution - Queue Script Next Checkin
- CWM - Automate - Custom Table - plugin_proval_queued_scripts
- CWM - Automate - Script - Run Queued Scripts
Variables
Document the various variables in the script. Delete any section that is not relevant to your script.
| Name | Description |
|---|---|
| TableName | The custom table to be created. |
| GroupName | The name of the group that is created by this script |
| GroupID | The system ID for the group |
| RetrievalScript | The script ID for the Run Queued Scripts script. |
| ATName | The name of the designated Autofix action. (~Autofix - Run Queued Scripts) |
| ATComment | The comment associated with the creation of the autofix action (Automatically Created Script by @ltrunbyuser@ This was created to run @ScriptName@) |
| ATGuid | The alert template needs a GUID statically set to (883f5185-289a-4763-8cc2-e4bf7dd1fb82) |
| AlertActionID | Holds the ID of the created Alert Action |
| AgentID | This holds the ID of the alert action |
| MonitorSQL | This is the monitor conditions to check for the online agent. |
| SQLInsert | The insert statement for the process |
User Parameters
| Name | Example | Required | Description |
|---|---|---|---|
| ScriptId | 7995 | True | The script ID for the script you wish to schedule |
| ScriptParameters | message=Hi There | False | Any parameters that need to be passed to the above script. |
Process
-
Offline
- Create the table if it doesn't exist.
- If the group 'Machines with Queued Scripts' doesn't exist, create it and move on.
- Get the group ID for the above group.
- Check to see if the target machine is a member of the group; if not, add the computer to the group.
- Check to see if the alert template exists; if it doesn't, create it.
- Check to see if the alert template action exists; if not, create it.
- Check to see if the alert template is assigned to the group; if not, assign it.
- Check to see if the autofix action is assigned to the monitor; if not, assign it.
- Check to see if the target script exists in the custom table for that target computer; if it doesn't, add it to the custom table.
- Add the computer to the group.
-
Online
- Schedule the script to run now on the machine.
Output
- Script log