The SimpleMDM team is here with some exciting new features! You can now schedule scripts to run later or recurringly, and you can automatically populate custom attributes from the output of scripts. These new features come with a slick new UI framework that will expand across the application going forward.
While SimpleMDM collects a considerable amount of data out of the box and can be used to perform many different actions on devices, the ability to run scripts opens the door to nearly endless possibilities. With auto attributes, collecting information from devices is now nearly infinite as well.
Scheduled scripts
SimpleMDM has supported running scripts on devices since 2021. However, you could previously run scripts only in real time (unless using the API to create script jobs programmatically). Now, admins can create script jobs and elect to run them in the future at a scheduled time and date — or even run them on a recurring basis.
SimpleMDM supports the ability to run scripts on devices in any language that the device itself supports locally. It also does not require an installed agent to do so.
Creating & scheduling a script job in SimpleMDM
Let’s say we want to schedule a script to check the uptime for some of our Macs.
To create a script:
Navigate to the Scripts section of the interface and click Create Script.
Upload a script file, or type it into the text editor directly. Scripts must start with a shebang (#!/bin/bash).
Save your script.
The script we’ll use for this example is very simple:
#!/bin/bash
uptime
To create a script job:
Under the Jobs section of the interface, click Create Job.
Give your job a name and select your script.
In the Run On field, select the devices or groups that you want to run the script on.
At this point, you have a few options:
Run ASAP: This runs the script immediately.
Run later: This runs the script once at a later time and date of your choosing.
Run recurringly: This allows you to schedule the script to run on a regular basis at specific times and days.
In this example, we will schedule a script to run every Monday at 8 a.m. Eastern Time. To do so, select Mon in the Run every field, 8:00 AM in the At field, and Eastern Time in the time-zone selector.
In the End recurring date field, you can choose if you want this job to stop running at a certain date or leave it blank to run it indefinitely.
Next is the Attribute Options field — we are going to leave this blank for the time being. We’ll cover it more later.
Finally, you can configure the Cancel job if not started after field to cancel a script job if it has not executed within a certain timeframe after it was scheduled. For example, if a device is offline when the script is scheduled to run and you want to ensure that it won’t execute at some unexpected time when that device comes back online, use this field. In this example, we’ll set it to 1 hour.
Now, click Create to schedule the script job. The script should execute within the specified timeframe.
Viewing job history
Now that we have run a script, you can view the results by going to the Jobs section.
Click the name of the job.
Select the Devices tab.
Then click the log corresponding to the device. This displays the output of the job along with some other metadata.
Auto attributes
Running remote scripts is nice, and scheduling scripts is even better, but wouldn’t it be great if we could capture the output and store it in SimpleMDM? Well, yes — that would be very nice! Auto attributes do just that.
When creating a script job, SimpleMDM now supports the ability to store the output. This is configurable using the Attribute Options field on the Script Jobs page! Here’s how to use it:
If you haven’t already, create a custom attribute by going to Configs > Attributes within the interface.
On the Script Jobs page, check the box labeled Store script output in custom attribute on device record.
In the Store output in field, select your custom attribute.
SimpleMDM supports the ability to sanitize the script output using regex — use the Sanitize output with field to configure this as needed.
Configure the other job settings as needed, and run it. That’s it!
Result: When devices respond with some output, the output is stored in the custom attribute on the device record.
Using our uptime example from earlier, here’s an example of what we see on the device record (under the Custom Attributes section of Device Details > Settings):
Scheduling scripts empowers admins to perform automated tasks on devices without having to do them manually in real time. Auto attributes allow admins to store information from devices based on the output of the scripts they run, drastically expanding the information collection and reporting capabilities of SimpleMDM. All attribute values are stored on device records within the interface and available via the Export Devices CSV. Custom attributes can even be included in the main Devices list in SimpleMDM by clicking the gear icon and editing the columns shown.
If you don’t already have SimpleMDM, sign up for a free trial to see these new features in action. You can also learn more about releases in our 2023 recap, or check out some of our personal favorites: welcome screen enhancements, account-driven enrollment, and Return to Service.
Happy scripting!