Jump to content

Recommended Posts

Posted

Good morning,

 

I've an entire year group of pupils where the first name and surname fields have been input the wrong way round. Is there a way I can easily bulk swap these over either within ADUC or using PowerShell?

 

Cheers

Posted

foreach ($user in (get-aduser -Filter * -searchBase "")) 
{Set-ADUser $user -GivenName $user.Surname -Surname $user.GivenName
}

 

Quick n Dirty (Shhh you lot) . if you aren't logged in as someone with permissions you'll need -Credential (var with creds in)

feel free to add -WhatIF to the set-aduser to preview first :) *cough check!*

Posted
Sorry, I should have checked the link. It looks like Powershell is the answer (but I can't think of the commands off the top of my head). Are there more fields, other than the givenName and sn that need changing? Unless specified otherwise, I believe fields like the displayname, sAMAccountName, userPrincipalName, mail, etc, are built automatically.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...