Skip to content

Commit 4e105bb

Browse files
authored
Update Get-DistributionGroupMember.md
1 parent 3863469 commit 4e105bb

File tree

1 file changed

+19
-30
lines changed

1 file changed

+19
-30
lines changed

exchange/exchange-ps/exchange/Get-DistributionGroupMember.md

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ ms.reviewer:
1212
# Get-DistributionGroupMember
1313

1414
## SYNOPSIS
15-
1615
This cmdlet is available in on-premises Exchange and in the cloud-based service. Some parameters and settings may be exclusive to one environment or the other.
1716

1817
Use the Get-DistributionGroupMember cmdlet to view the members of distribution groups and mail-enabled security groups.
@@ -33,23 +32,20 @@ Get-DistributionGroupMember [-Identity] <DistributionGroupMemberIdParameter>
3332
```
3433

3534
## DESCRIPTION
36-
3735
If your organization has multiple Active Directory domains, you may need to run the Set-ADServerSettings cmdlet with the ViewEntireForest parameter set to $true before running the Get-DistributionGroupMember cmdlet to view the entire forest. For more information, see Example 2.
3836

3937
You need to be assigned permissions before you can run this cmdlet. Although this topic lists all parameters for the cmdlet, you may not have access to some parameters if they're not included in the permissions assigned to you. To find the permissions required to run any cmdlet or parameter in your organization, see [Find the permissions required to run any Exchange cmdlet](https://learn.microsoft.com/powershell/exchange/find-exchange-cmdlet-permissions).
4038

4139
## EXAMPLES
4240

4341
### Example 1
44-
4542
```powershell
4643
Get-DistributionGroupMember -Identity "Marketing USA"
4744
```
4845

4946
This example returns the existing distribution group members for the distribution group named Marketing USA.
5047

5148
### Example 2
52-
5349
```powershell
5450
Set-ADServerSettings -ViewEntireForest $true
5551
@@ -58,10 +54,26 @@ Get-DistributionGroupMember -Identity "Marketing Worldwide"
5854

5955
This example sets the scope of the search to the entire forest by running the Set-ADServerSettings cmdlet, then the Get-DistributionGroupMember cmdlet searches the entire forest for the distribution group members in the Marketing Worldwide distribution group.
6056

57+
### Example 3
58+
```powershell
59+
$Groups = Get-UnifiedGroup -ResultSize Unlimited
60+
61+
$Groups | ForEach-Object {
62+
$group = $_
63+
Get-UnifiedGroupLinks -Identity $group.Name -LinkType Members -ResultSize Unlimited | ForEach-Object {
64+
New-Object -TypeName PSObject -Property @{
65+
Group = $group.DisplayName
66+
Member = $_.Name
67+
EmailAddress = $_.PrimarySMTPAddress
68+
RecipientType= $_.RecipientType
69+
}}} | Export-CSV "$env:USERPROFILE\Desktop\Office365GroupMembers.csv" -NoTypeInformation -Encoding UTF8
70+
```
71+
72+
This example downloads a comma-separated value (CSV) file containing all groups and members.
73+
6174
## PARAMETERS
6275

6376
### -Identity
64-
6577
The Identity parameter specifies the distribution group or mail-enabled security group. You can use any value that uniquely identifies the group. For example:
6678

6779
- Name
@@ -85,7 +97,6 @@ Accept wildcard characters: False
8597
```
8698
8799
### -Credential
88-
89100
The Credential parameter specifies the username and password that's used to run this command. Typically, you use this parameter in scripts or when you need to provide different credentials that have the required permissions.
90101
91102
A value for this parameter requires the Get-Credential cmdlet. To pause this command and receive a prompt for credentials, use the value `(Get-Credential)`. Or, before you run this command, store the credentials in a variable (for example, `$cred = Get-Credential`) and then use the variable name (`$cred`) for this parameter. For more information, see [Get-Credential](https://learn.microsoft.com/powershell/module/microsoft.powershell.security/get-credential).
@@ -104,7 +115,6 @@ Accept wildcard characters: False
104115
```
105116

106117
### -DomainController
107-
108118
This parameter is available only in on-premises Exchange.
109119

110120
The DomainController parameter specifies the domain controller that's used by this cmdlet to read data from or write data to Active Directory. You identify the domain controller by its fully qualified domain name (FQDN). For example, dc01.contoso.com.
@@ -123,7 +133,6 @@ Accept wildcard characters: False
123133
```
124134

125135
### -IgnoreDefaultScope
126-
127136
This parameter is available only in on-premises Exchange.
128137

129138
The IgnoreDefaultScope switch tells the command to ignore the default recipient scope setting for the Exchange PowerShell session, and to use the entire forest as the scope. You don't need to specify a value with this switch.
@@ -147,7 +156,6 @@ Accept wildcard characters: False
147156
```
148157

149158
### -IncludeSoftDeletedObjects
150-
151159
This parameter is available only in the cloud-based service.
152160

153161
The IncludeSoftDeletedGroups switch specifies whether to include soft-deleted group members in the results. You don't need to specify a value with this switch.
@@ -168,7 +176,6 @@ Accept wildcard characters: False
168176
```
169177

170178
### -ReadFromDomainController
171-
172179
This parameter is available only in on-premises Exchange.
173180

174181
The ReadFromDomainController switch specifies that information should be read from a domain controller in the user's domain. You don't need to specify a value with this switch.
@@ -191,7 +198,6 @@ Accept wildcard characters: False
191198
```
192199

193200
### -ResultSize
194-
195201
The ResultSize parameter specifies the maximum number of results to return. If you want to return all requests that match the query, use unlimited for the value of this parameter. The default value is 1000.
196202

197203
```yaml
@@ -208,35 +214,18 @@ Accept wildcard characters: False
208214
```
209215

210216
### CommonParameters
211-
212217
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/p/?LinkID=113216).
213218

214219
## INPUTS
215220

216221
### Input types
217-
218222
To see the input types that this cmdlet accepts, see [Cmdlet Input and Output Types](https://go.microsoft.com/fwlink/p/?LinkId=616387). If the Input Type field for a cmdlet is blank, the cmdlet doesn't accept input data.
219223

220224
## OUTPUTS
221225

222226
### Output types
223-
224227
To see the return types, which are also known as output types, that this cmdlet accepts, see [Cmdlet Input and Output Types](https://go.microsoft.com/fwlink/p/?LinkId=616387). If the Output Type field is blank, the cmdlet doesn't return data.
225228

229+
## NOTES
226230

227-
To download a comma-separated values (CSV) file containing all groups and members, use the following cmdlet:
228-
229-
230-
```powershell
231-
$Groups = Get-UnifiedGroup -ResultSize Unlimited
232-
$Groups | ForEach-Object {
233-
$group = $_
234-
Get-UnifiedGroupLinks -Identity $group.Name -LinkType Members -ResultSize Unlimited | ForEach-Object {
235-
New-Object -TypeName PSObject -Property @{
236-
Group = $group.DisplayName
237-
Member = $_.Name
238-
EmailAddress = $_.PrimarySMTPAddress
239-
RecipientType= $_.RecipientType
240-
}}} | Export-CSV "$env:USERPROFILE\Desktop\Office365GroupMembers.csv" -NoTypeInformation -Encoding UTF8
241-
```
242-
231+
## RELATED LINKS

0 commit comments

Comments
 (0)