---
title: Managing Distribution Groups with PowerShell
tags: [powershell, exchange, distribution-groups, office365, administration]
---

# Managing Distribution Groups with PowerShell

Distribution groups are used for sending emails to a group of people without having to type each recipient's name. This guide covers how to manage them using PowerShell.

**Parent Topic:** [[programming/PowerShell/ExchangeOnline|PowerShell Exchange Online Commands]]
**Related:** [[programming/PowerShell/PowerShell|PowerShell Comprehensive Guide]]

## Prerequisites
Ensure you are connected to Exchange Online:
```powershell
Connect-ExchangeOnline
```

## Creating a Distribution Group
```powershell
New-DistributionGroup -Name "All Staff" `
                      -Alias "allstaff" `
                      -PrimarySmtpAddress "allstaff@yourdomain.com" `
                      -Type Distribution
```

## Managing Members

### Add a Member
```powershell
Add-DistributionGroupMember -Identity "All Staff" -Member "jdoe@yourdomain.com"
```

### Remove a Member
```powershell
Remove-DistributionGroupMember -Identity "All Staff" -Member "jdoe@yourdomain.com" -Confirm:$false
```

### Get Group Members
```powershell
Get-DistributionGroupMember -Identity "All Staff"
```

## Advanced Settings

### Require Sender Authentication
To prevent external senders from emailing the group:
```powershell
Set-DistributionGroup -Identity "All Staff" -RequireSenderAuthenticationEnabled $true
```

### Moderation
To require approval for messages sent to the group:
```powershell
Set-DistributionGroup -Identity "All Staff" -ModerationEnabled $true -ModeratedBy "admin@yourdomain.com"
```

---
Return to [[programming/PowerShell/ExchangeOnline|PowerShell Exchange Online Commands]]