In this video we go through one of my favorite macOS in Intune features, Custom Attributes.
We can run a script that picks up the information we want about the device and send it back to Intune.
The hardest part is to write the script, but do not worry, there are many examples to use directly of the Internet; check the link below for a few examples.
Links: github.com/microsoft/shell-in...
Scripts in video:
1. Count Configuration Profiles:
#!/bin/bash
John Bryntze 12th June 2023
Get how many configuration profiles exists on device
JBNprofiles="$(profiles -C | wc -l)"
JBNprofile_count="$(echo $JBNprofiles - 1 | bc)"
if [ "$JBNprofile_count" -gt 0 ]; then
echo $JBNprofile_count
fi
if [ "$JBNprofile_count" -le 0 ]; then
echo 0
fi
2. Last logged in user
#!/bin/sh
John Bryntze 11th June 2023
Check who is the last logged in user
JBNlastUser=`/usr/bin/last -1 -t console | awk '{print $1}'`
if [ $JBNlastUser == "wtmp" ]; then
echo "No logins"
else
echo $JBNlastUser
fi
3. Reboot date
#!/bin/bash
John Bryntze
11th June 2023
Get Reboot time
JBNbootTime=$(sysctl kern.boottime | awk '{print $5}' | tr -d ,)
JBNformattedTime=$(date -jf %s $JBNbootTime "+%F %T")
echo "${JBNformattedTime}"
Full Playlist: • Learn to master and ma...
Негізгі бет macOS Custom Attributes - - Manage macOS in Intune (7/10)
Пікірлер: 11