Skip to main content

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

Hi Bob



We use this





!/bin/bash -v



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



echo "<result>$_FULLNAME_</result>"



With this you get both username and Full Name.
You can just edit it top exclude the full name.



/Michael


Reply