Export users based on Departments on office 365 |Multi Domain
Syed Sabih Haider
MCT | Solution Specialist Modern Workplace @ Hitachi Energy | Leading fight against cybercrime and trying to make a digital world more secure and accessible
Here are the steps to export the users based on Departments on office 365 (even if you have multi-domains). Here it is
- Download the PowerShell Module from Here(https://connect.microsoft.com/site1164/Downloads/DownloadDetails.aspx?DownloadID=59185)
- Download “AdministrationConfig-V1.1.166.0-GA.msi”
- Install this Package on your PC.
- Go to Start -> Open PowerShell “Run as Administrator”
- Type “Connect-MsolService”
- Give the Credential of your Global admin.
- Type Get-MsolUser -Department “Computer Science” or whatever department name other than Computer Science
- You can find the department by going to user's details --> edit Display Name --> under contact Information --> Deparment
- Then make a folder in C Drive “CSV”
- Then Type Get-MsolUser -Department "Computer Science" |Select-Object DisplayName, Department, MobilePhone, UserPrincipalName|Export-Csv C:\CSV Folder\ComputerScience.csv
- Then go to the C:\CSV\ComputerScience.csv
- If you have more than 1 UPN or Domain
- Get-MsolUser -All -DomainName "domain.com" -Department "Computer Science" | Select-Object DisplayName, Department, UserPrincipalName |Export-Csv C:\csv\ComputerScience.csv
Thanks