Exporting Entra ID Group Members (All) with PowerShell – All about Microsoft Endpoint Manager

Exporting Entra ID Group Members (All) with PowerShell – All

Exporting Entra ID Group Members (All) with PowerShell:

Just lately, whereas working with Intune deployments, I used to be requested to extract units from a particular group right into a CSV format. This activity appeared simple, however drawback arose when making an attempt to collect all members, together with these inside nested teams.

Whereas the Intune or Entra ID portal affords a handy choice to export members utilizing direct members, bulk operations, and a easy click on on “Obtain members,” it falls brief in relation to exporting units related to nested teams. This limitation spurred the exploration of different strategies, resulting in the invention of PowerShell as a robust resolution.

The next screenshot exhibits how one can obtain the direct members utilizing the Entra ID or intune console.

If you wish to obtain all members utilizing the console, there isn’t any obtain members accessible.

image

Exporting Members with PowerShell

In contrast to the portal’s constraints, PowerShell allows us to extract complete gadget particulars not accessible by way of direct member downloads. Leveraging the Microsoft Graph command Get-MgGroup, a part of the “Microsoft.Graph.Teams” module, we achieve entry to an array of gadget info essential for deployment eventualities.

Earlier than diving into the script execution, be certain that the executing account have the mandatory graph permissions, primarily learn entry. With out satisfactory permissions, Graph might limit entry, hindering the script’s performance.

For extra details about the Powershell command and module, please refer

image

image

Script Overview

The script’s performance extends past the portal’s limitations, empowering customers to export each direct and nested group members effortlessly. Here is a concise breakdown of its operation:

  1. Module Validation: The script verifies the presence of the Entra ID teams module and installs it if absent, guaranteeing seamless execution.
  2. Graph API Connection: Establishing a connection to the Microsoft Graph API with requisite permissions is important for accessing Entra ID group knowledge.
  3. Consumer Enter: Consumer is prompted to enter the Entra ID group title, facilitating focused member extraction.
  4. Information Extraction: Upon validation, the script retrieves the group’s ID and exports member particulars to a CSV file. This file encompasses essential gadget info corresponding to title, working system, creation date, registration date, final sign-in date, and gadget ID.

The script is uploaded to Github repository for obtain.

Screenshots of the script execution and output knowledge.

image

Output:

image

image

Conclusion

In abstract, PowerShell serves as a sturdy software for circumventing portal limitations and extracting complete gadget knowledge for deployment functions. By leveraging the Get-MgGroup command, customers can streamline Intune deployments and fulfill requests for exporting all units related to Entra ID teams.


We use cookies to enable site functionality and collect data about user interactions. By clicking Accept, you agree to our use for advertising, analytics, and support.