Exchange-Online-PowerShell-Recipes

Exchange Online PowerShell Recipes

Exchange Online PowerShell Recipe Logo

A Collection of PowerShell Scripts and One-Liners to Use With Exchange Online
Not enough for a cookbook, just some recipes.

About

This repo is for anyone who manages Exchange Online using PowerShell. All the recipes solve a common administration problem. Use this information in any way that improves your process. If you want to know more about why this repo was created, read the FAQ.

Requirements

You need a Microsoft 365 or Office 365 Subscription with access to Exchange Online. In addition to Exchange Online access, you may also need permissions or management roles assigned to your account. Review Microsoft’s documentation on Exchange permissions here. If you need a test environment, sign up for a Microsoft 365 Developer account and use that tenant for testing. To execute commands, you must be connected to Exchange Online using the Exchange Online PowerShell V3 module. If you are not connected, you’ll receive an error message.

PS > Get-EXOMailbox
Get-EXOMailbox: You must call Connect-ExchangeOnline before calling any other cmdlet.

Warning

Some recipes make changes that could have unintended consequences. Use at your own risk.

Use the -WhatIf or -Confirm parameter when executing commands that make changes (Set, Remove, Enable, Disable) or test recipes before changing a production environment. Recipes may have the Enable or Disable portion commented out for safety.

Contributing

Contributions welcomed. Please review the Contributing Guidelines before submitting a Pull Request (PR).


Table of Contents

Antispam And Antimalware

Extras

Mailbox Recipes

Mail Flow Recipes

Organization

Policy and Compliance Recipes

Role Based Access Control Recipes

User and Group Recipes