SYNOPSIS
Retrieves all empty groups (zero members) in Microsoft Entra ID.SYNTAX
DESCRIPTION
The Get-EmptyGroup function retrieves all groups from Microsoft Entra ID via the Microsoft Graph API and identifies those with no members. It supports optional export to Excel or CSV for further analysis and cleanup.EXAMPLES
EXAMPLE 1
EXAMPLE 2
EXAMPLE 3
PARAMETERS
-ExportToExcel
When specified, exports the results to an Excel file in the user’s profile directory. Requires the ImportExcel module.CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.INPUTS
OUTPUTS
System.Collections.Generic.List[Object]
NOTES
OUTPUT PROPERTIES Returns a collection of custom objects with the following properties:- DisplayName: Display name of the group
- ObjectId: Unique identifier of the group
- Type: Type of group (Microsoft 365, Dynamic, Mail-enabled Security, Security, Distribution, Other)
- Mail: Primary email address of the group
- Created: Creation date of the group (yyyy-MM-dd)
- Description: Description of the group