macOS Custom Attributes - - Manage macOS in Intune (7/10)
Вставка
- Опубліковано 20 чер 2023
- 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...
Its great tutorial for beginner dude. If possible to make the same for iOS devices(Iphone and ipad).that would be helpful for us
Thanks, I got a serie recorded for iPhone/iOS, so I should be able to get it out, not so happy about it since I couldn't use Apple Business Manager to it, but it will show some basic management at least :)
Great Video ! Thx
Thanks so much and please enhance video resolution ❤
Thanks and will check video resolution for next video
Thank u for this excellent video. I wish ask you: Can we use custom attribute result to set configuration profile variable. For example to set Client ID in authentication configuration profile as %myCustomAttribute% Thank you in advance!
Thank you so much, I really like your question because the custom attributes could be used for more than just information.
I'm not sure, initially, this can be captured from MSGraph, since all in Intune is stored there, so technically, it should be possible to run a script that queries MSGraph for the custom attribute value and then pass it on to another item.
I have not tested it and probably nothing that be done in a a few hours, but it should be possible.
@@IntuneVitaDoctrina thank you so much. I finally reach my custom attribute value result with MS Graph.
Unfortunately powershell doesn't recognize
Get-MgBetaDeviceManagementDeviceCustomAttributeShellScript, but only SET command. Only postman give me the answer.
Now i need to export data from Postman to a file and use it in a powershell script.
WOW@@user-um2np7ic1n well done, I'm impressed, would love to see the PowerShell script once you finished it, bravo!
Custom attributes are a good idea but I don't know why microsoft limits their use.
It is not possible to use them to create dynamic groups, I find that a shame
I agree totally with you, the Azure Dynamic Groups are a joke, you can only use AzureAD attributes and not those Intune finds. You can of course create your own PowerShell scripts that get this data from MS Graph and then update Azure AD groups from the script with logic based on the Custom Attributes, but yeah nothing you do easily.