Get-GroupMemberCount
Module: MO_Module
Applies to: Exchange Online, Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019
Use the Get-GroupMemberCount function to simply create a .CSV file of all the e-mail enabled groups and current member count. May not be the most elaborate task, but a common one that is more than just 1 line of PowerShell code.
Get-GroupMemberCount
SYNOPSIS
Get member count of groups.
SYNTAX
Get-GroupMemberCount [[-Path] <Object>] [[-FileName] <Object>] [<CommonParameters>]
DESCRIPTION
Gets all distribution groups and security enabled groups and presents name and member count of each group. Outputs the content into a csv file.
EXAMPLES
EXAMPLE 1
Get-GroupMemberCount
This will obtain distribution group list in CSV export. Default path is: $env:temp\DistributionGroups.csv
EXAMPLE 2
Get-GroupMemberCount -path c:\temp -FileName DGs.csv
This will obtain distribution group list in CSV exported file to c:\temp titled DGs.csv
PARAMETERS
-Path
Path of output location for CSV file to be placed.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: $env:TEMP
Accept pipeline input: False
Accept wildcard characters: False
-FileName
File name to be filled in as the target .csv file that is to be used.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: DistributionGroups.csv
Accept pipeline input: False
Accept wildcard characters: False
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.