Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dallin/934b408bd1427f3065e91128f083ebc9 to your computer and use it in GitHub Desktop.
Save dallin/934b408bd1427f3065e91128f083ebc9 to your computer and use it in GitHub Desktop.
Create an "Everyone" distribution list with dynamic membership. Includes all active user accounts (no shared mailboxes) with a job title.
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline
New-DynamicDistributionGroup -Name "Everyone" -Alias "everyone@example.com" -RecipientFilter "RecipientTypeDetails -eq 'UserMailbox' -and Title -ne `$null -and UserAccountControl -ne 'AccountDisabled, NormalAccount'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment