Use Scripts
Table of Contents
Once you've created and/or selected a script that meets your needs, you can run it on an individual asset or in bulk, on multiple assets. You also have the option to run a script repeatedly, and/or on a schedule.
Best Practices
For any scripts that may cause unintended changes to an asset, or require debugging/troubleshooting to get a desired result, we recommend that you test your script on a dedicated internal system (or directly in PowerShell) before storing and running it in Syncro.
When running scripts on a recurring schedule, it's important not to run it too often. That's because while the script is running, other operations can't. If you have too many long-running scripts, they can get backed up into a queue. Though it's possible to schedule runs for every 15 minutes, we recommend scheduled scripts be run no more than daily.
Run a Script
On an Individual Asset
To run a script on an individual Asset, follow these steps:
- Navigate to the Assets & RMM tab.
- Select an individual asset. Syncro displays the asset's Details Page.
- Click the Scripts subtab.
- Click +Add to Queue.
- In the Run Script pop-up, select the appropriate values:
- Category: Use Syncro and/or custom Script Categories to filter the list of Scripts shown in the Scripts dropdown menu.
-
Script: Select the name of the script you want to run. If your script includes variables of type “runtime,” you'll see additional fields display:
Any variables that have default values will also display here.
Note: You can't change the value for a runtime variable after you schedule the script or add it to the queue. You'll need to clear the script from the queue before making changes. - Run As: Select how you'd like to run the script. You should run most scripts as System.
-
Frequency: How often you want to run the script. Select from:
- Run Once: Syncro will run the script only one time.
-
Run Repeatedly: Syncro will run the script many times, according to the timing you select (e.g. every 15 minutes, every other week, etc.).
(If you select “hourly,” Syncro removes the minute option because its no longer relevant.)
-
When to Run: Select from:
- Run Now: The script will run on the asset when you click Run.
- Schedule: Select a date and time for the script to run on the asset. The script will run according to this schedule when you click Schedule.
- Skip Offline Assets: Check this box to prevent the script from attempting to run on any assets that are offline.
- Click Run (or Schedule, depending on your previous selections).
Notes:
- Some scripts have additional field values you'll need to complete before you can run them. For example, the Run Antivirus script has Scan Type radio buttons and additional checkboxes.
- New script schedules set to “Run Now” may take up to 20 minutes before running.
- For any scripts using scheduled time, Syncro uses the Time Zone setting in your General Preferences. For example, if the Time Zone is set to (GMT-08:00) Pacific Time and you schedule the script to run at 3:00 a.m., then that script will run at 3:00 a.m. Pacific Time, even if it's running on an asset located halfway around the world in a completely different time zone.
To close the Run Script pop-up window without taking action, click the X in the upper right.
In Bulk, on Multiple Assets
If you want to run a script on multiple devices, there are three ways you can do that:
- In Policies, using the Syncro Policy Builder's Scripting policy category. Add Setup Scripts, which run when you first install the Syncro Agent or when the policy is applied, and/or set up Script Schedules.
- On the specific assets you select from the Assets & RMM page/table. Check one or more of the boxes next to the assets to select them. Then, from the Bulk Actions menu, select "Run Script…". The Run Script pop-up window displays the additional option of running your script on all Syncro Devices matching any search criteria you selected from the table:
Click Run (or Schedule, depending on your selections).
Note: For specifics about each field in the Run Script pop-up window, see On an Individual Asset. - On all assets of a given Asset Type. On the Assets & RMM page, make sure all of your assets are deselected (i.e., no checkboxes are checked). Then, from the Actions menu, select “Run Script.” The Run Script pop-up window displays an additional Asset Type option:
- All Syncro Devices: Runs the script on every asset listed in the table.
- Saved Search: Runs the script on any assets that meet the criteria of the Saved Asset Search you select.
- Customer: Runs the script on any assets belonging to the (Customer) Organization you select.
- Policy Folder: Runs the script on any assets on a policy for the (Customer) Organization and Policy Folder you select. Check the "Include All Nested Folders" box if desired.
Click Run (or Schedule, depending on your previous selections).
Note: For specifics about each field in the Run Script pop-up window, see On an Individual Asset.
View Script Schedules, Statues & Outcomes
Once you've run some scripts, there are two places you can view their statuses and outcomes.
For a Specific Asset
- Navigate to the Assets & RMM tab/page.
- Select an individual asset, then click the Scripts subtab. Syncro displays any Recurring Scripts, scripts in the Script Queue, and the Script History:
- Recurring Scripts: The 30 most recent scripts. (If you have more than 30 scripts scheduled, Syncro will run them even if they don't appear here.) Click Delete to delete the recurrence of the script.
- Script Queue: Any scripts currently in the queue to be run. (This includes scripts that are actively “enqueued,” so recurring scripts display here only if they are scheduled to run, enqueued, waiting for the asset to be back online (or for the system to finish the script ahead of it.)) Click Delete to delete any pending scripts in the queue.
-
Script History: Displays the 30 most recently run scripts, a Status indicator and Date/timestamp (e.g., “completed at Mon 04-14-25 09:09 AM”). Possible statuses that you should include when creating your scripts include:
- Success: green; exit value = 0
- Error: red; exit value = 1
- Failure: gray; exit value = 2 or higher
- Click the hyperlinked Name of the script to open its edit page. Click the horizontal ellipsis to take an additional actions such as (view) Script Output and Rerun/Retry Script.
For a Specific Script
To see whether a specific script is scheduled on an asset, scheduled on a policy, or currently queued, follow these steps:
- Navigate to the Scripts tab.
- Click the horizontal ellipsis at the end of the row, then select “Scheduled Runs.” Syncro displays the All Scheduled Executions page:
- Currently Queued: Click the hyperlinked Device name to view that asset's Details page. Or, click the red X to delete any currently queued scripts.
- Scheduled On Asset: Check one or more boxes to bulk Edit or Delete (from the Manage button). Or, click the red X to delete individual schedules.
- Scheduled On Policy: Click the hyperlinked Policy name to update the policy, if needed.
Tip: In addition to what's described here, you can also click into any individual script from the Scripts tab/module and view the outcome on the right side of its Edit page, in the LATEST [N] SCRIPT RUNS section (limited to 5):