Importing users details from Office 365 to Active directory

Mohammed Hamada
Mohammed Hamada used Ask the Experts™
on
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?
Note
UPN matches on both O365 and on AD.

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
PowerShell? :) Either the AD module (if you are using anything above 2008 R2) or the Quest cmdlets.
Mohammed HamadaSenior IT Consultant

Author

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?

thanks
Most Valuable Expert 2015
Distinguished Expert 2018
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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial