Scripts · PowerShell

Get-GroupsMembersManagers

Export Entra group members with manager and profile details to CSV for Viva Insights organizational data uploads.

View on GitHub

What it is

A PowerShell script that uses the Microsoft Graph PowerShell module to report Microsoft Entra group members and their managers. An interactive menu lets you export users from all groups, from one group chosen by display name, or from a CSV with a UPN column. It writes EntraGroupMembersExport.csv with profile details and the manager's UPN.

Why use it

  • Build the file for organizational data uploads in Microsoft 365 or Viva Advanced Insights from existing Entra groups.
  • Include extended profile fields such as job title, department, office location, company, and address details.
  • Target a pilot population with a CSV of UPNs instead of the whole tenant.

How to use it

  1. Install the Microsoft Graph PowerShell module.
  2. Run the script, sign in with consent for the Group.Read.All and User.Read.All scopes, and choose an option from the menu (all groups, one group, a CSV of UPNs, or exit). The CSV is written to the current directory:
.\Get-GroupsMembersManagers.ps1

Prerequisites

  • Microsoft Graph PowerShell module
  • Account that can consent to the Group.Read.All and User.Read.All Microsoft Graph scopes
  • Optional CSV with a UPN column for the CSV option