-
Notifications
You must be signed in to change notification settings - Fork 37
Pro Tips
This page highlights some MDM agnostic tricks and pro tips for customizing Baseline.
In Baseline, anywhere you can define a ScriptPath you can instead provide the path to a binary, and then pass arguments using the AdditionalArguments key.
<dict>
<key>Scripts</key>
<array>
<dict>
<key>Arguments</key>
<string>10</string>
<key>AsUser</key>
<false/>
<key>DisplayName</key>
<string>Sleep 10</string>
<key>Icon</key>
<string>SF=bed.double.circle,color=purple</string>
<key>ScriptPath</key>
<string>/bin/sleep</string>
<key>Subtitle</key>
<string>This script item just sleeps for 10 seconds. Useful for testing your Baseline DialogListOptions.</string>
</dict>
</array>
</dict>
This is useful for calling policies using the jamf binary, one-line scripts like using /usr/bin/touch to create a file, or any other reason you want Baseline to run a command-line application.
It is also possible to put command substitutions directly into your Baseline configuration profile.
Consider the following example of DialogListOptions which uses system_profiler to put the Serial Number in the --infobox section. We also can use a combination of system_profiler and dscl to welcome the user by name and add the device model name to the message.
<key>DialogListOptions</key>
<string>--infobox "Serial: $(/usr/sbin/system_profiler SPHardwareDataType | awk '/Serial Number/ {print $NF}')" --message "Welcome to your new $(system_profiler SPHardwareDataType | awk -F ': ' '/Model Name/ {print $2}'), **$(dscl . -read /Users/$(stat -f%Su /dev/console) RealName | tail -n1 | cut -d ' ' -f2)**"</string>
In this example, we use system_profiler output in json format and pipe to jq to get the screen height in pixels. Then we use bc to do math and calculate 75% of the screen height and set the dialog height to that value. We also set --width to a set value of 950.
This trick would only work on macOS 15+ due to the use of built in jq.
<key>DialogListOptions</key>
<string>--height $(echo "scale=0; $(system_profiler -json SPDisplaysDataType | jq -r '.SPDisplaysDataType.[].spdisplays_ndrvs.[0]._spdisplays_resolution' | cut -d ' ' -f3) * .75 / 1" | bc) --width 950</string>
- Mosyle
- JumpCloud
- Addigy
- SimpleMDM
- FileWave
- Workspace ONE
- Jamf Pro
- Microsoft Intune
- Hexnode
- Iru formerly Kandji
- Apple Business
- FleetDM (Need contribution)
- Your MDM Provider Here... (Need contributions!)