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.
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.
Extend your scripting capabilities by getting to know more parameters:
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
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.
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.
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
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*
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.
- Bulk-import new users and mailboxes into Active Directory.
- Seek and zap unwanted user accounts.
- Find inactive computers.
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