PowerShell Set-Mailbox

PowerShell Set-Mailbox For Exchange 2010

Set-Mailbox is a handy PowerShell cmdlet for modifying an existing Exchange mailbox.  When changing multiple mailboxes employ a second PowerShell cmdlet such as Get-Mailbox, then pipe its output into Set-Mailbox’s input.

 ♣

Getting Started with Set-Mailbox

Before unleashing the power of any ‘Set-xyz’ cmdlets, I find it safer to check with the corresponding Get-xyz first.  Another technique is to wade straight in with Set-Mailbox, but append the -WhatIf parameter until you are sure that the results are what you expected.

Example 1: Increase the Message Size Limits

The only required parameter for Set-Mailbox is -Identity.  As an alternative to the Exchange Alias, you could specify Distinguished name (DN) Domain\Account,  User principal name (UPN), GUID, or the SmtpAddress; it makes no difference to Set-Mailbox’s -Identity parameter.

Set-Mailbox -Identity "GuyT"  -MaxSendSize 5mb

Note 1a:  While -Identity is the only mandatory parameter, it’s worth researching the other switches or parameters to improve your scripts.

List PowerShell’s Set-Mailbox Parameters

Get-Help Set-Mailbox

Note 1b:  Other interesting parameters include the ‘Archive’ family, e.g. ArchiveQuota and the Forwarding family e.g. ForwardingSmtpAddress.

Note 1c:  Set-Mailbox -type accepts the following values:
Regular
Room
Equipment
Shared

Example 2: Piping Input with Get-User

One of the beauties of PowerShell is piping. In this case obtain a flow of ‘Managers’ using another cmdlet, and stream them into Set-Mailbox so that you can manipulate their properties.

Get-User -Filter "Title -eq ‘Managers’" | Set-Mailbox -MaxReceiveSize 20Mb

Note 2a: An alternative source cmdlet is Get-Mailbox, the piping techique would be the same as in the above script.

Exchange Permissions

Manipulating another user’s mailbox is a responsible task.  Thus before you execute the appropriate PowerShell you must be a member of these exchange groups:

  • ‘Organization Management role group’
  • ‘Server Management management role group’
    (Management management is not a typo!)

Instead of the EMC try this PowerShell command:

New-ManagementRoleAssignment -Role "Organization Management role" -User YourName

Guy Recommends:  SolarWinds’ Free Bulk Mailbox Import ToolFree Download Bulk Mailbox Import Tool

Import users from a spreadsheet, complete with their mailbox.  Just provide a list of the users with the fields in the top row, and save as .csv file.  Then launch this FREE utility, match your Exchange fields with AD’s attributes, click and import the users.  Optionally, you can provide the name of the OU where the new mailboxes will be born.

There are also two bonus tools in the free download, and all 3 have been approved by Microsoft:

  1. Bulk-import new users and mailboxes into Active Directory.
  2. Seek and zap unwanted user accounts.
  3. Find inactive computers.

Download your FREE bulk mailbox import tool.

Example 3: Set-Mailbox -Type

Before you use a parameter such as -Type, I strongly recommend that you test with Get-Mailbox -Type, before you unleash a command that’s actually going to change this attribute.

 Set-Mailbox -Type Room

Compare PowerShell with the EMC

From a learning point-of-view I like a walk-through in the EMC (Exchange Management Console), the benefit is you can compare the PowerShell script with what you see in the Exchange GUI.Set-Mailbox PowerShell cmdlet

  • Launch the EMC, navigate to the Recipient Configuration Mailbox (see screenshot right)

Other Members of the PowerShell Mailbox Family of Cmdlets

As I have alread mentioned I would start with Get-Mailbox, but there are other similar PowerShell cmdlets, research thus:

Get-Command -noun Mailbox

More Examples of Mailbox Cmdlets

Try this: Get-Command -noun Mailbox*

You should find Get-MailboxServer and Get-MailboxDatabase.

Note 3: See more on PowerShell’s Set-Mailbox.

Guy Recommends: Permissions Analyzer – Free Active Directory ToolFree Permissions Analyzer for Active Directory

I like thePermissions Monitor because it enables me to see quickly WHO has permissions to do WHAT.  When you launch this tool it analyzes a users effective NTFS permissions for a specific file or folder, takes into account network share access, then displays the results in a nifty desktop dashboard!

Think of all the frustration that this free utility saves when you are troubleshooting authorization problems for users access to a resource.  Give this permissions monitor a try – it’s free!

Download Permissions Analyser – Free Active Directory Tool

Summary of PowerShell Set-Mailbox

Set-Mailbox is the best cmdlet for modifying an existing Exchange mailbox.  For changing multiple mailboxes employ a second PowerShell cmdlet such as Get-User, then pipe its output into Set-Mailbox.

If you like this page then please share it with your friends

 


See more PowerShell Cmdlets for Exchange 2010:

Exchange 2010 Home   • Get-ExchangeServer   • Set-ExchangeServer   • New-SystemMessage   • SP1

Get-Mailbox   • Get-MailboxStatistics   • Connect-Mailbox   • Enable-Mailbox   • Disable-Mailbox

PowerShell Exchange Cmdlets   • Set-Contact    • New-Mailcontact   • Add-MailboxPermission -identity