Home SharingIsCaring. Export User Profiles to csv
Post
Cancel

SharingIsCaring. Export User Profiles to csv

Summary

This script will export user profiles to csv. Users can be exported from a list of users.

Pre-requisites

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

m365 login --authType deviceCode

# Get all users and their properties, add properties as needed with --properties and separate with comma
m365 aad user list --properties "displayName,mail"

# Get all users and their properties and export to csv
m365 aad user list --output csv --properties "displayName,mail,givenName,jobTitle,mail,mobilePhone,officeLocation,preferredLanguage,surname,userPrincipalName,id" > users.csv

# Get current user with all properties
m365 aad user get --id "@meId"

# get any user with all properties
m365 aad user get --id "UserID"

PNP Script sample site

Script sample site

This post is licensed under CC BY 4.0 by the author.

Tip of the day - Powershell for April first. Tricks and pranks part 1

Easter Egg JavaScript Script