Posted on 11-21-2016 02:19 AM
I'm looking for an Extension attribute which can collect ComputerName and respective last logged in user name.
The answer might already be available around the list somewhere, but I haven't had any luck finding it... tried to find out in Jamfnation EA lists but again no luck.
Can somebody help me out in this?
Thanks,
Sourabh
Posted on 11-21-2016 05:13 AM
Hi Bob
We use this
LASTUSER=$(ls -l /dev/console | cut -d " " -f4)
FULLNAME=$(dscl localhost -read /Active Directory/YOUREDOMAIN/All Domains/Users/$LASTUSER | sed -n '/RealName/{n;p;}' | cut -c 2-)
if [ "$LASTUSER" == "" ]; then
echo "<result>No logins</result>"
else
With this you get both username and Full Name.
You can just edit it top exclude the full name.
/Michael