Importing users details from Office 365 to Active directory

Hello everyone, I have already migrated 500 users from Exchange on-premises to Office 365. then removed everything on-premises however the same 500 users are now on a new AD (DC) and I want to import all their details and info from Office 365 to Active directory on-premises including the Proxy addresses they have.

I already have exported all the users details from Office 365 so Is there any tool or way out there to import it to AD on-prem?
UPN matches on both O365 and on AD.

LVL 24
Mohammed HamadaSenior IT ConsultantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vasil Michev (MVP)Commented:
PowerShell? :) Either the AD module (if you are using anything above 2008 R2) or the Quest cmdlets.
Mohammed HamadaSenior IT ConsultantAuthor Commented:
How do I do the matching of users between on-premises and O365 ?

Users on O365 have all their details updated.

Users on AD have nothing except their first, last name only and UPN.

How will I update users on AD using powershell?

Vasil Michev (MVP)Commented:
Depends on what you have exported. Assuming that you have a "UPN" field in the CSV, you can do a simple lookup and then set the relevant properties:

$users =  Import-CSV blabla.csv

foreach ($user in $users) { Get-ADUser -Filter "UserPrincipalName -eq '$($user.UPN)'" | Set-ADUser -GivenName $user.GivenName  }

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Office 365

From novice to tech pro — start learning today.