Exchange PowerShell – Creating Stuff

In this blog I’ve listed a collection of my 4 most commonly used Exchange PowerShell tasks for creating new objects in Exchange Online or Exchange Server 2016. These are the typical PowerShell scripts needed during the deployment of new Exchange infrastructure.

Creating Resources (rooms/equipment)

Create a ‘Room’ resource;

New-Mailbox -Name MainConfRoom -DisplayName "Main Conference Room" -Room

Create an ‘Equipment’ resource;

New-Mailbox -Name Projector -DisplayName "Projector" - Equipment

Add a group of rooms to a distribution group;

New-DistributionGroup -Name "All Meeting Rooms" -RoomList

Turn an existing distribution group into a room list;

Set-DistributionGroup -Identity "All Meeting Rooms" -RoomList

Creating Shared Mailboxes

A shared mailbox is a mailbox that multiple users can use to read and send email messages. Share mailboxes can also be used to provide a common calendar, allowing multiple users to schedule and view vacation time or work shifts.

Create a shared mailbox

This example uses ‘New-Mailbox’ to create the shared mailbox and ‘Add-MailboxPermission’ gives the HR security Group (HRSG) permissions to the shared mailbox. To grant the Send On Behalf permission to HRSG for Career@company.com we use the ‘Set-Mailbox’ command.

 New-Mailbox -Shared -Name "Careers" -DisplayName "Career Information" -Alias Career | Ser-Mailbox - GrantSendOnBehaldTo HRSG | Add-MailboxPermission -User HRSG -AccessRights FullAccess -InheriteanceType All

 Creating External Contacts

Mail contacts are mail-enabled directory service objects that contain information about people or organizations that exist outside your Exchange or Exchange Online organization. Each mail contact has an external email address.

User the ‘New-MailContact’ command to create a new External Mail Contact. You can also add additional SMTP addresses to the contact using the ‘Set-MailContact’ command.

New-MailContact -Name "Someone" -ExternalEmailAddress someone@somewhere.com
 Set-MailContact -Identity Someone -EmailAddresses SMTP:someone@somewhere.com, you@here.co

Note: You can only add additional SMTP addresses in PowerShell, not the UI.

Creating Distribution Lists

A distribution group is an email address that can be created and then any emailed received will be forwarded to anyone who is a member in the group. The membership of the group forms the distribution list.

Use the ‘New-DistributionGroup’ command to create a new distribution group with the initial properties. Use the ‘Set-DistributionGroup’ command to change the groups properties.

New-DistributionGroup -Name "Internal IT" -Alias itinternal -MemberJoinRestriction open
Set-DistributionGroup -Identity "Internal IT" -MemberJoinRestriction 'ApprovalRequired'

What is a Dynamic Distribution Group?

Dynamic distribution groups are mail-enabled Active Directory group objects that are created to expedite the mass sending of email messages and other information within a Microsoft Exchange organization.

Unlike regular distribution groups that contain a defined set of members, the membership list for dynamic distribution groups is calculated each time a message is sent to the group, based on the filters and conditions that you define. When an email message is sent to a dynamic distribution group, it’s delivered to all recipients in the organization that match the criteria defined for that group.

(it just means that the members are “Dynamic”, not “Static”. The members will be selected according to a filter you specify at each time a mail is sent.

 For example, when you create a dynamic distribution list for each of the remote offices, then any new users you added to the OU for a remote office will automatically be added to the DDL.)

 

 

 


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s