We are having about 450 PCs for students and since a long time, the computername is the same as the local username.
When I add a user to the machine with the script above, the user is added, but it is not visible in the user Access control.
We found out (via computermanagement -> compmgmt.msc), that the user is not Show als a member of the Group "Users".
Although: When I do retype the Add-LocalGroupMember line it says, that it is already there.
Adding Users with the same username as the machine Name in the UAC works fine.