Skip to main content

Hey all,
Just a quick run down of my environment...we are running MBA OS X 10.7 in a active directory environment. We just found out the new centralized printing with has an issue with how OS X sends a print job. When the OS X sends a print job to our print server (smart look server), its sends the print as "Full Name" located in the System preference/users & groups. The smart look server looks at the username field and OS X is sending that information as "Full Name" instead of the account name(username).



When I change the "Full Name" to my "account name/username" (in my case "Kim, Johnny" to "jkim"), the printer sees the job is from "jkim" and is able to print.



I am thinking maybe a script I can push to pull the account name and rename the "Full Name" field. Also, for those who know AD, the username has to be pulled from "User logon name" located in the account tab in AD. Reason being is because we have users whose name is William Jones but logins as Bill Jones(bjones).



Ill take suggestions if there are any other more efficient ways.



Thanks in advance!!

@msblake



Thanks for the tip, but I'm not sure I have it correct?



#!/bin/sh



/usr/bin/who | awk '/console/{ print $1 }'



ShortName=/usr/bin/who | awk '/console/{ print $1 }'
FullName=dscl . -read /Users/$ShortName RealName | tail -1



else
dscl . -change /Users/$ShortName RealName "$FullName2" "$ShortName"
fi


@Johnny.Kim][/url][/url I did run it as a login trigger, and got this outcome: However, it did seem to work, I see the name is changed now...so we do have a solution, although it would be cool if I could do it to the current logged in user without a restart.



Executing Policy Reset full name...
Mounting Main Distribution Point to /Volumes/CasperShare...
Running script resetfullname.sh...
Script exit code: 54
Script result:
attribute status: eDSAttributeNotFound
DS Error: -14134 (eDSAttributeNotFound)


Steven, you're piping in "fullname2" but the variable isn't there. Copy and paste the code below and give that a try in terminal. run with "sudo bash -x -v /path/to/file"



ShortName=`/usr/bin/who | awk '/console/{ print $1 }'`
FullName=`dscl . -read /Users/$ShortName RealName | awk 'BEGIN {FS=": "} {print $1}'`
FullName2=`echo $FullName | awk '{print $2,$3}'`

if [ "$ShortName" == "$FullName2" ]; then
exit

else
dscl . -change /Users/$ShortName RealName "$FullName2" "$ShortName"
fi

I recommend switching the ShortName command to use:



ls -l /dev/console | awk '{print $3}'


The problem with the who | awk syntax is that if you happen to use Fast User Switching and have more than one account actually logged in, even if one is switched out, you'll get inaccurate results on the username. You could still run into problems even with the above command I recommend, but its only likely to happen in a case where another user is remoted into the Mac with ScreenSharing and "logged in" under another account, which probably doesn't happen much if at all.
But I agree that you should make your scripts as portable as possible and try not to rely on something like $3 exclusively. If you later decided to use that same script outside of a login or Self Service policy, you'd need to edit it to make it work. Starting off with something like:



ShortName=$(ls -l /dev/console | awk '{print $3}')


is going to serve you better long term, in my opinion.