With so many  companies preferring Microsoft 365 as the platform for their internal collaboration and other uses, it becomes very important to check which users are present and fetch their profile properties from SharePoint.
To achieve this we will use PnP PowerShell and AzureAD PowerShell Modules to fetch all the users and extract their user profile properties from SharePoint
If we are using Window 10 or we have  PowerShellGet then we can run the below commands to install PnP PowerShell and AzuerAD Modules
Install PnP PowerShell Module,
Install AzureAD Module

PowerShell Script

Once we have installed all the dependencies  we will now do two operations:
  1. Connect to Azure AD and fetch all the users present in the Azure AD
  2. Iterate through all the users and fetch user profile properties for each user
To run the below PowerShell script we should have admin access to fetch all the users and fetch the user profile properties.
Two inputs will be  required:


A CSV file with all the user profile properties will be generated in the specified path. We can use this file for additional analytics.