Wrong info in Username and Full Name fields

avail
New Contributor III

Hello all,

I'm seeing an odd thing in our inventory in JSS (v9.9.2) where some Macs will show root as the current User and a completely random name in the Full Name field. The name will show up for all the Macs that are showing with the User root. I can't seem to make heads or tails of why some Macs start reporting this. Today there are 22 Macs showing up this way (image attached).e480b2d1122a4f55b96c86de80c20dd6

We do have a Last User extension attribute enabled:

#!/bin/sh
lastUser=`defaults read /Library/Preferences/com.apple.loginwindow lastUserName`

if [ $lastUser == "" ]; then
    echo "<result>No logins</result>"
else
    echo "<result>$lastUser</result>"
fi

As well (and I suspect this is where it's going a bit wrong), we are auto-populating the Full Name field by pulling the current user. Here's the script from JAMF Nation we are using:

#!/bin/sh

sleep 5

loggedInUser=$( ls -la /dev/console | cut -d " " -f 4 )

/usr/local/bin/jamf recon -endUsername $loggedInUser

exit 0

I've seen some other discussions where having multiple users logged in via Fast User Switching can cause issues, but we have that disabled on most Macs.

Thanks for any suggestions!

1 ACCEPTED SOLUTION

thoule
Valued Contributor II

I suspect that your script that runs recon is running when no user is logged in so root is being returned. You could wrap that recon line in an 'if' to exclude root....

if [ $loggedInUser != "root" ];   then
    /usr/local/bin/jamf recon -endUsername $loggedInUser
fi

View solution in original post

4 REPLIES 4

thoule
Valued Contributor II

I suspect that your script that runs recon is running when no user is logged in so root is being returned. You could wrap that recon line in an 'if' to exclude root....

if [ $loggedInUser != "root" ];   then
    /usr/local/bin/jamf recon -endUsername $loggedInUser
fi

avail
New Contributor III

Thanks! Have made those changes and will see how it goes - certainly makes sense :D

karthikeyan_mac
Valued Contributor

Even we have the same issue in our environment. We don't run any script for reporting there username. We can see around 80 Macs with same "Full Name" and others details but the Username is different. We are running JSS 9.81.

Anybody else came across this issue?

avail
New Contributor III

Just wanted to report back that thoule's solution worked a treat. I also added our local admin account to the exception as well. Thanks!