Get-ExchangeDistributionGroup
Exchange: Lists all Distribution Groups in the organization
#Requires -Version 5.1
[CmdletBinding()]
Param (
[string]$Filter
)
Process {
try {
$params = @{
'ErrorAction' = 'Stop'
}
if ($Filter) { $params.Add('Filter', $Filter) }
$groups = Get-DistributionGroup @params
$results = foreach ($g in $groups) {
[PSCustomObject]@{
Name = $g.Name
DisplayName = $g.DisplayName
Alias = $g.Alias
PrimarySmtpAddress = $g.PrimarySmtpAddress
GroupType = $g.GroupType
RecipientTypeDetails = $g.RecipientTypeDetails
}
}
Write-Output ($results | Sort-Object Name)
}
catch {
throw
}
}Specifies an optional filter to apply to the retrieval.