Scripting for Your MDM: Best Practices for Addigy Users
If you’ve spent any time on our user forums, you’ve probably spent some time sifting through the community device facts and the scripts your peers have submitted. But you may not have tried your hand at scripting within your own mobile device management (MDM) solution.
Scripting may seem intimidating, but there’s no reason not to start out with something small. Once you begin to customize how you manage Apple devices in your environment, you may begin to feel more adventurous and dig deeper into the community scripts for inspiration and advice.
But let’s not get ahead of ourselves. Here’s how to optimize your MDM solution for your company by running your own scripts.
A Metaphor to Get You Started: Think of Scripting for Your MDM Solution as a Workout
Perhaps when you first start a workout regime, you look online and find a plan that outlines core day, arm day, and leg day. It will give you a premade plan. This is the MDM solution you get from Addigy right out of the metaphorical box.
At the beginning of this workout regime, you get a prescribed method to follow and for the first stretch, that’s enough to make you feel good. But as you grow and level up, you might want to add some new exercises into your workout. Over time, you’ll recognize your own strengths and weaknesses. If things are going well, you may start to set ambitious goals that require even more specialty equipment or engagement.
For IT admins using an MDM solution, this is the point at which you’ll probably get interested in scripting. To step away from the home gym metaphor (we’ve got COVID-WFH brain), what you need to know is that scripting is a powerful tool that will allow you to customize your Addigy mobile device management portal to better serve your goals and your end users.
Three Things You Need to Start Scripting for Your MDM
1: A language
Coding isn’t a requirement for managing Apple devices, but if you want to create custom scripts it’s important to be familiar with at least one of the most common languages:
- Bash, Shell, and Z Shell are among the most popular scripting languages because they’re relatively simple and there is nothing additional to install. Once you have a project or task, you can open your terminal app and start banging away!
- Python is another popular language in the Mac community. It’s more powerful but has some added complexity. Python also requires a separate download build and run.
If you’re coming to a mobile device management solution from the Linux or Apple universe, you’ll likely have no trouble taking in the basic concepts of scripting, but if not, don’t be intimidated. Anyone can learn to script or code.
2: A Place to Write Your Scripts
The second thing you’ll need is a program to write your scripts into. While a simple text editing tool or text app works, tools designed specifically for programming or scripting can identify proper formatting and assist with logic, making your code more accurate and more efficient. In no particular order, we recommend:
- Atom from GitHub
- Visual Studio Code from Microsoft
- Xcode from Apple
3: An Application to Review Your Code for Issues
You should also have an application to review your code for issues. These allow you to drop in your code, and the application will let you know if you’ve made any errors in syntax.
These applications help because they have syntax highlighting, which means that the program will alert you if you write something that seems to break the rules of the language you’re writing. Think of these applications as grammar check tools for scripting.
Although this program doesn’t work for all languages, we love using Shellcheck.net. It’s an open source tool that ensures that you’re quoting well and cuts down on the introduction of unintended variables.
How Addigy Supports Scripting: Device Facts
Addigy uses chunks of scripts to return small bits of useful information called “device facts.” For example, one device fact might answer the question, “Is this device enrolled in my MDM solution?” or “Is the required antivirus software installed?”
If you have specific network or device requirements, you can write custom device facts by scripting and plug them into your MDM solution. This might mean writing a script to install a specific piece of software: if this file exists and this version is older than a specific date, install this newer version.
You can script this to happen automatically at scale, making one set of decisions to determine how your devices will be managed rather than making those adjustments on each Apple device in your network.
A Few Best Practices for Beginners
Once you’re up and running, there are a few pieces of advice to follow. These may sound like common sense, but they’re worth making part of your routine:
- Always read a script before you install it. You should always have an understanding of what the script includes and what it’s intended to do. This will also help you evaluate whether or not it’s well written.
- Share your scripts. The Addigy community forum makes it easy to share what you’ve been working on. This can be a valuable opportunity to get feedback and to help someone else. If you’re going to build a script, chances of someone else needing someone similar is helpful. In addition to Addigy, GitHub is a great place to get peer review.
- Manage your code. Github and GitLab have features that allow you to save versions of your code. This will enable you to revert back to an older version if something goes wrong down the line. Or, if you want to try something different, you can create a fork in the road to make sure you get it right. Managing your code is just good version management.
This may sound like it’s a ways down the road for you now, but if you’re just getting started, it’s a good idea to begin with a small project and see how other IT admins write resilient code for the same issue. From there, you’ll have a broader picture of what’s possible.
Scripting for Your MDM Solution Is Not a Requirement
Maybe you started to read this article hoping to hear that you don’t need to learn how to script. Maybe you just wanted permission to try inserting a custom device fact you saw in the forums. Both of those options are available to you.
If the options that come baked into Addigy’s MDM solution are serving your IT team and your end users well, there’s no imperative that you do your own scripting. But if you develop this skill and apply it, you can take your mobile device management skills to the next level and transform your team’s workflows.