mirror of
https://github.com/MLBZ521/MacAdmin.git
synced 2026-02-03 14:03:26 +00:00
v1.0 = Initial Version
+ Initial Version
This commit is contained in:
20
Jamf Pro/Extension Attributes/jamf_ea_LastUser.sh
Normal file
20
Jamf Pro/Extension Attributes/jamf_ea_LastUser.sh
Normal 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
|
||||
Reference in New Issue
Block a user