Skip to content

Get-ExchangeDistributionGroupInfo

Exchange: Retrieves detailed properties of a Distribution Group

#Requires -Version 5.1

[CmdletBinding()]
Param (
    [Parameter(Mandatory = $true)]
    [string]$Identity,

    [string[]]$Properties = @('Name', 'Alias', 'DisplayName', 'PrimarySmtpAddress', 'RecipientTypeDetails', 'GroupType', 'ManagedBy', 'IsValid', 'DistinguishedName', 'Guid')
)

Process {
    try {
        if ($Properties -contains '*') {
            $Properties = @('*')
        }

        $group = Get-DistributionGroup -Identity $Identity -ErrorAction Stop
        $result = $group | Select-Object $Properties

        if ($null -eq $result) {
            throw "Distribution Group '$Identity' not found or properties could not be retrieved."
        }

        Write-Output $result
    }
    catch {
        throw
    }
}

Specifies the Identity of the distribution group.

Specifies an array of properties to retrieve. Defaults to standard administrative properties. Use '*' for all.

An interactive directory of PowerShell scripts.