macOSLAPS
macOSLAPS copied to clipboard
[Enhancement] Add Account Detection To Extension Attributes
It may be helpful to modify the extensions to check if the account set in LocalAdminAccount exists on the machine. There are situations where the account would either have never existed or been removed improperly. Adding a check could help IT track that. Napkin math but I think adding something like this at line 20 could do it
LocalAdminAccount=$(defaults read /Library/Managed\ Preferences/edu.psu.macoslaps.plist LocalAdminAccount)
checkUser=$(dseditgroup -o checkmember -m $LocalAdminAccount localaccounts | awk '{ print $1 }')
if [ "$LocalAdminAccount" == "" ] ; then
echo "<result>Not Configured</result>"
elif [ "$checkUser" != "yes" ] ; then
echo "<result>$LocalAdminAccount Not Present</result>"
elif [ -e $LAPS ] ; then
...
I believe this is something that could be added to the extension attributes quite easily. I'll see what I can do.
The extension attributes have been updated to reflect this change. Please let me know if you feel this is inadequate.