Last active
October 21, 2025 19:05
-
-
Save smashism/ef6f8ba7009038b4f5a031f25449225f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Extension attribute to see if a local user account is mdm enabled. | |
| # Based on https://derflounder.wordpress.com/2025/04/04/identifying-mdm-managed-user-accounts-on-macos-sequoia/, thanks Rich. | |
| # ekw 2025-10-16 | |
| # Get the GUID of the managed local user account | |
| MDMManagedUserGUID=$(/usr/sbin/system_profiler SPConfigurationProfileDataType | grep "Managed User" | sed -E 's/.* ([0-9A-F-]{36}) .*/\1/') | |
| # Find the username of the mdm enabled user account based on GUID | |
| MDMManagedUserUsername=$(/usr/bin/dscl . -search /Users GeneratedUID "$MDMManagedUserGUID" | awk '{print $1}' | head -n 1 2>/dev/null) | |
| /bin/echo "<result>$MDMManagedUserUsername</result>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment