IT_Man_Dan Posted August 27, 2021 Posted August 27, 2021 Morning all, Does anyone have a quick easy way to change a year groups display name to be the same as their username in AD. I was hoping you could do it as a bulk action in AD by selecting all going to properties and setting display name to %username% but sadly you can't seem to edit the display name in this way. Many thanks
ShellfishClive Posted August 27, 2021 Posted August 27, 2021 (edited) You could do this with PowerShell: $users = Get-ADUser -SearchBase "insert OU Path" -Filter * -Properties * foreach($user in $users){ $username = $user.SamAccountName Set-ADUser -Identity $Username -DisplayName $Username } You'll need to find the DN name of the OU if you are targeting an OU, easiest way to get it to make sure you have Advanced Features on under "View" in Active Directory, right click the OU with your year group in, go to Attribute Editor tab and copy the DistinguishedName in there and paste it "insert OU Path" part of this script. Edited August 27, 2021 by ShellfishClive 2
IT_Man_Dan Posted August 27, 2021 Author Posted August 27, 2021 @ShellfishClive Once I ran it properly it worked a charm, thanks. 1
jthompson Posted August 27, 2021 Posted August 27, 2021 Wisesoft's Bulk AD Users utility is a nice powerful tool for doing bulk operations using a GUI.
HPlum78 Posted August 27, 2021 Posted August 27, 2021 I always add this when i see -filter * and - properties * on any command. Can we be careful when running commands with this as you would not be popular running that against large directories! Look back through my pasts posts for more.
Davit2005 Posted August 27, 2021 Posted August 27, 2021 I did a project about 7 years ago at a previous place where we changed the display name, upn, username and alligned the users home folder to the same username. If I can find the script I dig it out.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now