Update DEPARTMENT attrribute for M365 users

Modified on Tue, 7 Jun, 2022 at 1:38 PM

Bulk Update Contact Information like Department field for all users from Powershell



PS C:\WINDOWS\system32> Set-ExecutionPolicy RemoteSigned



PS C:\WINDOWS\system32> Connect-ExchangeOnline



PS C:\WINDOWS\system32>  $user_file = Import-CSV  C:\Users\naufil.mirsinge\Downloads\Import_Contact_Sample.csv

PS C:\WINDOWS\system32> $user_file | ForEach-Object { Set-user -identity $_.Userprincipalname -department $_.department}

WARNING: The command completed successfully




Format of CSV file as below



 

UserPrincipalNameDepartment
naufil.mirsinge@netcorecloud.comMail Support

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article