PowerShell Get-Mailbox

PowerShell Get-Mailbox For Exchange 2010

Get-Mailbox is a classic PowerShell command for configuring users’ Exchange email settings.  Not only is it useful in its own right, but also the results from Get-Mailbox provide valuable input to other Exchange based PowerShell cmdlets.


Getting Started with Get-Mailbox

Get-Mailbox is an ideal command for making the transition from the EMC to PowerShell.  ‘Get’ is the most common PowerShell verb, while Mailbox is a key exchange noun.  Another benefit of starting with this cmdlet is that no parameters are ‘required’.

#Exchange 2010 PowerShell Script

Note 1: While no parameters are compulsory, it does not mean to say that it’s not worth researching your options, for example, suppose you wish to refine the list of mailboxes.

List the Get-Mailbox Parameters

Extend your scripting capabilities by getting to know more parameters:

Get-Help Get-Mailbox

Use the information to reduce the output to just database DB01:

Get-Mailbox -Database DB01

Or home-in on one particular user:

Get-Mailbox -Identity "Guy Thomas"

At the other extreme, get a longer list by appending -ResultSize Unlimited :

Get-Mailbox -ResultSize Unlimited

Free Download of Exchange Monitor from SolarWindsGuy Recommends: The SolarWinds Exchange Monitor

Here is a free tool to monitor your Exchange Server.  Download and install the utility, then inspect your mail queues, monitor the Exchange server’s memory, confirm there is enough disk space, and check the CPU utilization.

This is the real deal – there is no catch.  SolarWinds provides this fully-functioning freebie, as part of their commitment to supporting the network management community.

Free Download of SolarWinds Exchange Monitor

Where Next with Get-Mailbox?

Employ Get-Mailbox to pipe a stream of data into other PowerShell cmdlets such as Export-Mailbox or Import-Mailbox.

Get-Mailbox -Identity "Guy Thomas | Export-Mailbox -PSTFolderPath C:\PSTFiles\GuyT.csv

Note 2: While Get-Mailbox is useful and interesting on its own, remember that it can provide a valuable stream of data for other cmdlets.

See more about Export-Mailbox.

Exchange Permissions

If you think about it, being able to connect a mailbox is a responsible task.  Thus before you execute the appropriate PowerShell script 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

Compare PowerShell with the EMCGet-Mailbox PowerShell cmdlet

From a learning point-of-view it it’s worth a walk-through in the Exchange Management Console (EMC), the benefit is you can compare the PowerShell script with what you see in the Exchange GUI.

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

Other Members of the Mailbox Family of Cmdlets

Get-Command -noun Mailbox

More Examples of PowerShell’s Mailbox Cmdlets

Note 3: There is also Get-MailboxStatistics

Try this: Get-Command -noun Mailbox*

Note 4: See more on PowerShell’s Get-Mailbox.

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.

Summary of PowerShell Get-Mailbox

Get-Mailbox is a suitable command for learning about how PowerShell can interogate Exchange.  Not only is it useful on its own, but also the results from Get-Mailbox can be piped into other Exchange based PowerShell cmdlets.

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