Last active
May 17, 2022 18:39
-
-
Save jps3/7777f263e0962db6423718b688db03d5 to your computer and use it in GitHub Desktop.
Jamf Pro Computer Extension Attribute to perform cursory check for macOS auto login user enabled
This file contains 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 | |
# | |
# Created by jps3@lehigh.edu on ? (History empty) | |
# Updated by jps3@lehigh.edu on 2022-05-17 | |
# | |
# Jamf Pro Computer Extension Attribute to perform cursory check for macOS auto login user enabled | |
# https://gist.github.com/jps3/7777f263e0962db6423718b688db03d5 | |
# | |
# Jamf Pro > Settings > Computer Management > Extension Attributes | |
# Display Name : auto-login-user | |
# Description : Cursory check for existence of 'kcpassword' file and 'autoLoginUser' plist key and reports result. | |
# Data Type : String | |
# Inventory Display : General | |
# Input Type : Script | |
# | |
# Check for non-zero-sized kcpassword file | |
if [[ -s "/etc/kcpassword" ]]; then | |
# Read value of autoLoginUser key (may be empty string, or non-existent key and exit non-zero) | |
AUTO_LOGIN_USERNAME="$(defaults read /Library/Preferences/com.apple.loginwindow.plist autoLoginUser)" | |
# If non-zero-length value returned ... | |
if [[ -n "$AUTO_LOGIN_USERNAME" ]]; then | |
# Report the username | |
echo "<result>${AUTO_LOGIN_USERNAME}</result>" | |
else | |
# Report empty value | |
echo "<result></result>" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment