O'Reilly logo

Microsoft Exchange Server 2013 PowerShell Cookbook - Second Edition by Mike Pfeiffer, Jonas Andersson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Managing distribution groups

In many Exchange environments, distribution groups are relied upon heavily and require frequent changes. This recipe will cover the creation of distribution groups and how to add members to groups, which might be useful when performing these tasks interactively in the shell or through automated scripts.

How to do it...

  1. To create a distribution group, use the New-DistributionGroup cmdlet:
    New-DistributionGroup -Name Sales
    
  2. Once the group has been created, adding multiple members can be done easily using a one-liner, as follows:
    Get-Mailbox -OrganizationalUnit Sales | 
      Add-DistributionGroupMember -Identity Sales
    
  3. We can also create distribution groups whose memberships are set dynamically:
    New-DynamicDistributionGroup -Name ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required