As the 201 version to the Master Command Line Interface Basics session at last year's JAMF Nation User Conference (JNUC), Matt Schalk took us past the fundamentals of the command line and showed us how to solve several common challenges.
As an education services engineer at JAMF Software, Schalk shared his knowledge on automatic user and location data assignment, smart group creation from a file, and how to convert local admins to standard users with common tools like redirects, conditionals, loops, and other flow controls.
Schalk started his session by walking the group through how to grab user information from an LDAP server and parse it into the JSS since "by default the JSS does not gather user information," he said. Getting user data into the JSS is the first step in building a customized inventory.
From there Schalk talked about the importance of setting up extension attributes to help differentiate similar hardware and create custom computer types. He demoed using if-then statements, assigning variables, and the echo commands via terminal to create a script that supports the extension attribute.
Finally Schalk showed the crowd how to use the command line to list all users on a Mac—including hidden admins and root which should not be modified—to determine what admin rights they have. He then showed off the for command to execute a recurring command on the array of users to either promote or demote their admin rights.
In his Q&A, he answered many questions about the best practices for the command line and scripting. He also showed some hilarious examples that are still in the terminal manual pages. All of Schalk's examples are on JAMF Nation and can be found here: https://jamfnation.jamfsoftware.com/discussion.html?id=17402