Skip to main content

Hello, I have created a policy to push a local account to all of our enrolled computers. I have labled the Username and Full Name as "Student". The issue is that our students can not go into that account and change the name to their name. After speaking with customer support they do not know of any scripts that would allow a standard user to make the change without a Admin password.



So I am coming here to see if anyone has created a script or has seen one that will allow students to change the name of their account.

Thanks, I put this script in my server and tried it with the trigger of once per user. This is the log I got on from my test computer.



Executing Policy Name Change...
Running script accountchange.sh...
Script exit code: 54
Script result: User entered the full name of please work
attribute status: eDSAttributeNotFound DS Error: -14134 (eDSAttributeNotFound)
Running Recon...
Retrieving inventory preferences from https://server.org:8443/...
Locating accounts...
Locating package receipts...
Searching path: /Users
Locating software updates...
Locating plugins...
Locating printers...
Searching path: /Applications
Gathering application usage information...


@lpadmin,
Change the line for the "CurrName" from-



CurrName=$(dscl . read /Users/${loggedInUser} RealName | awk '{getline; print}' | sed 's/^ *//')


To



CurrName=$(dscl . read /Users/${loggedInUser} RealName | awk -F: '{print $NF}' | sed -e 's/^ *//;/^$/d')


The "student" accounts may not be putting the full name on a new line, in which case my getline in the awk part would grab the wrong information, hence the eDsAttributeNotFound error (just a theory).



The above new line should work if the name is short and appears on the same line in dscl or on a second line.


That works, again I can not thank you enough for writing these scripts for me.