v1.0 = Initial Version

+ Initial Version
This commit is contained in:
Zack T
2018-10-30 12:43:37 -07:00
parent d7c2f05ca3
commit 423c28b317

View File

@@ -0,0 +1,20 @@
#!/bin/bash
###################################################################################################
# Script Name: jamf_ea_LastUser.sh
# By: Zack Thompson / Created: 10/30/2018
# Version: 1.0 / Updated: 10/30/2018 / By: ZT
#
# Description: A Jamf Extension Attribute that displays the last user to log in.
#
###################################################################################################
lastUser=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
if [[ -z $lastUser ]]; then
echo "<result>No logins</result>"
else
echo "<result>${lastUser}</result>"
fi
exit 0