Get-MailboxStatistics (ExchangePowerShell) (2023)

  • Reference
Module:
ExchangePowerShell
Applies to:
Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019, Exchange Online

This cmdlet is available in on-premises Exchange and in the cloud-based service. Some parameters and settings may be exclusive to one environment or the other.

Use the Get-MailboxStatistics cmdlet to return information about a mailbox, such as the size of the mailbox, the number of messages it contains, and the last time it was accessed. In addition, you can get the move history or a move report of a completed move request.

Note: In Exchange Online PowerShell, we recommend that you use the Get-EXOMailboxStatistics cmdlet instead of this cmdlet. For more information, see Connect to Exchange Online PowerShell.

For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax.

Syntax

Get-MailboxStatistics -Database <DatabaseIdParameter> [[-StoreMailboxIdentity] <StoreMailboxIdParameter>] [-CopyOnServer <ServerIdParameter>] [-DomainController <Fqdn>] [-Filter <String>] [-IncludeMoveHistory] [-IncludeMoveReport] [-IncludeQuarantineDetails] [-NoADLookup] [<CommonParameters>]
Get-MailboxStatistics [-Identity] <GeneralMailboxOrMailUserIdParameter> [-Archive] [-CopyOnServer <ServerIdParameter>] [-DomainController <Fqdn>] [-IncludeMoveHistory] [-IncludeMoveReport] [-IncludeQuarantineDetails] [-IncludeSoftDeletedRecipients] [-NoADLookup] [<CommonParameters>]
Get-MailboxStatistics -Server <ServerIdParameter> [-DomainController <Fqdn>] [-Filter <String>] [-IncludeMoveHistory] [-IncludeMoveReport] [-IncludePassive] [-IncludeQuarantineDetails] [-NoADLookup] [<CommonParameters>]

Description

On Mailbox servers only, you can use the Get-MailboxStatistics cmdlet without parameters. In this case, the cmdlet returns the statistics for all mailboxes on all databases on the local server.

The Get-MailboxStatistics cmdlet requires at least one of the following parameters to complete successfully: Server, Database or Identity.

You can use the Get-MailboxStatistics cmdlet to return detailed move history and a move report for completed move requests to troubleshoot a move request. To view the move history, you must pass this cmdlet as an object. Move histories are retained in the mailbox database and are numbered incrementally and the last executed move request is always numbered 0. For more information, see "Example 7," "Example 8," and "Example 9" in this topic.

You can only see move reports and move history for completed move requests.

You need to be assigned permissions before you can run this cmdlet. Although this topic lists all parameters for the cmdlet, you may not have access to some parameters if they're not included in the permissions assigned to you. To find the permissions required to run any cmdlet or parameter in your organization, see Find the permissions required to run any Exchange cmdlet.

Examples

Example 1

Get-MailboxStatistics -Identity AylaKol

This example retrieves the mailbox statistics for the mailbox of the user Ayla Kol by using its associated alias AylaKol.

Example 2

Get-MailboxStatistics -Server MailboxServer01

This example retrieves the mailbox statistics for all mailboxes on the server MailboxServer01.

(Video) How to get Mailbox usage using PowerShell in Exchange Online #PowerShell #ExchangeOnline

Example 3

Get-MailboxStatistics -Identity contoso\chris

This example retrieves the mailbox statistics for the specified mailbox.

Example 4

Get-MailboxStatistics -Database "Mailbox Database"

This example retrieves the mailbox statistics for all mailboxes in the specified mailbox database.

Example 5

Get-MailboxDatabase | Get-MailboxStatistics -Filter 'DisconnectDate -ne $null'

This example retrieves the mailbox statistics for the disconnected mailboxes for all mailbox databases in the organization. The -ne operator means not equal.

Example 6

Get-MailboxStatistics -Database "Mailbox Database" -StoreMailboxIdentity 3b475034-303d-49b2-9403-ae022b43742d

This example retrieves the mailbox statistics for a single disconnected mailbox. The value for the StoreMailboxIdentity parameter is the mailbox GUID of the disconnected mailbox. You can also use the LegacyDN.

Example 7

Get-MailboxStatistics -Identity AylaKol -IncludeMoveHistory | Format-List

This example returns the summary move history for the completed move request for Ayla Kol's mailbox. If you don't pipeline the output to the Format-List cmdlet, the move history doesn't display.

Example 8

$temp=Get-MailboxStatistics -Identity AylaKol -IncludeMoveHistory$temp.MoveHistory[0]

This example returns the detailed move history for the completed move request for Ayla Kol's mailbox. This example uses a temporary variable to store the mailbox statistics object. If the mailbox has been moved multiple times, there are multiple move reports. The last move report is always MoveReport[0].

Example 9

$temp=Get-MailboxStatistics -Identity AylaKol -IncludeMoveReport$temp.MoveHistory[0] | Export-CSV C:\MoveReport_AylaKol.csv

This example returns the detailed move history and a verbose detailed move report for Ayla Kol's mailbox. This example uses a temporary variable to store the move request statistics object and outputs the move report to a CSV file.

Parameters

-Archive

The Archive switch specifies whether to return mailbox statistics for the archive mailbox that's associated with the mailbox. You don't need to specify a value with this switch.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019, Exchange Online

-CopyOnServer

This parameter is available only in on-premises Exchange.

The CopyOnServer parameter is used to retrieve statistics from a specific database copy on the specified server.

You can use any value that uniquely identifies the server. For example:

  • Name
  • FQDN
  • Distinguished name (DN)
  • Exchange Legacy DN

If you don't use this parameter, the command is run on the local server.

Type:ServerIdParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2013, Exchange Server 2016, Exchange Server 2019

-Database

This parameter is available only in on-premises Exchange.

The Database parameter returns statistics for all mailboxes on the specified database. You can use any value that uniquely identifies the database. For example:

  • Name
  • Distinguished name (DN)
  • GUID

This parameter accepts pipeline input from the Get-MailboxDatabase cmdlet.

Type:DatabaseIdParameter
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
Applies to:Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019
(Video) Exchange 2019:- Get mailbox statistic with PowerShell

-DomainController

This parameter is available only in on-premises Exchange.

The DomainController parameter specifies the domain controller that's used by this cmdlet to read data from or write data to Active Directory. You identify the domain controller by its fully qualified domain name (FQDN). For example, dc01.contoso.com.

Type:Fqdn
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019

-Filter

This parameter is available only in on-premises Exchange.

The Filter parameter uses OPATH syntax to filter the results by the specified properties and values. The search criteria uses the syntax "Property -ComparisonOperator 'Value'".

  • Enclose the whole OPATH filter in double quotation marks " ". If the filter contains system values (for example, $true, $false, or $null), use single quotation marks ' ' instead. Although this parameter is a string (not a system block), you can also use braces { }, but only if the filter doesn't contain variables.
  • Property is a filterable property.
  • ComparisonOperator is an OPATH comparison operator (for example -eq for equals and -like for string comparison). For more information about comparison operators, see about_Comparison_Operators.
  • Value is the property value to search for. Enclose text values and variables in single quotation marks ('Value' or '$Variable'). If a variable value contains single quotation marks, you need to identify (escape) the single quotation marks to expand the variable correctly. For example, instead of '$User', use '$($User -Replace "'","''")'. Don't enclose integers or system values in quotation marks (for example, use 500, $true, $false, or $null instead).

You can chain multiple search criteria together using the logical operators -and and -or. For example, "Criteria1 -and Criteria2" or "(Criteria1 -and Criteria2) -or Criteria3".

For detailed information about OPATH filters in Exchange, see Additional OPATH syntax information.

For example, to display all disconnected mailboxes on a specific mailbox database, use the following syntax: 'DisconnectDate -ne $null'.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2013, Exchange Server 2016, Exchange Server 2019

-Identity

The Identity parameter specifies the mailbox that you want to return statistics for. You can use any value that uniquely identifies the mailbox. For example:

  • Name
  • Alias
  • Distinguished name (DN)
  • Canonical DN
  • Domain\Username
  • Email address
  • GUID
  • LegacyExchangeDN
  • SamAccountName
  • User ID or user principal name (UPN)
Type:GeneralMailboxOrMailUserIdParameter
Position:1
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
Applies to:Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019, Exchange Online

-IncludeMoveHistory

The IncludeMoveHistory switch specifies whether to return additional information about the mailbox that includes the history of a completed move request, such as status, flags, target database, bad items, start times, end times, duration that the move request was in various stages, and failure codes. You don't need to specify a value with this switch.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019, Exchange Online
(Video) How To Find Mailbox Sizes In Exchange Using PowerShell

-IncludeMoveReport

The IncludeMoveReport switch specifies whether to return a verbose detailed move report for a completed move request, such as server connections and move stages. You don't need to specify a value with this switch.

Because the output of this command is verbose, you should send the output to a .CSV file for easier analysis.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019, Exchange Online

-IncludePassive

This parameter is available only in on-premises Exchange.

The IncludePassive switch specifies whether to return statistics from all active and passive database copies. You don't need to specify a value with this switch.

If you don't use this switch, the command retrieves statistics from active database copies only.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2013, Exchange Server 2016, Exchange Server 2019

-IncludeQuarantineDetails

This parameter is available only in on-premises Exchange.

The IncludeQuarantineDetails switch specifies whether to return additional quarantine details about the mailbox that aren't otherwise included in the results. You can use these details to determine when and why the mailbox was quarantined. You don't need to specify a value with this switch.

Specifically, this switch returns the values of the QuarantineDescription, QuarantineLastCrash and QuarantineEnd properties on the mailbox. To see these values, you need use a formatting cmdlet. For example, Get-MailboxStatistics <MailboxIdentity> -IncludeQuarantineDetails | Format-List Quarantine*.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2013, Exchange Server 2016, Exchange Server 2019

-IncludeSoftDeletedRecipients

This parameter is available only in the cloud-based service.

The IncludeSoftDeletedRecipients switch specifies whether to include soft deleted mailboxes in the results. You don't need to specify a value with this switch.

(Video) Connecting to Exchange Online in PowerShell

Soft-deleted mailboxes are deleted mailboxes that are still recoverable.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-NoADLookup

This parameter is available only in on-premises Exchange.

The NoADLookup switch specifies that information is retrieved from the mailbox database, and not from Active Directory. You don't need to specify a value with this switch.

This switch helps improve cmdlet performance when querying a mailbox database that contains a large number of mailboxes.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2013, Exchange Server 2016, Exchange Server 2019

-Server

This parameter is available only in on-premises Exchange.

The Server parameter specifies the server from which you want to obtain mailbox statistics. You can use one of the following values:

  • Fully qualified domain name (FQDN)
  • NetBIOS name

When you specify a value for the Server parameter, the command returns statistics for all the mailboxes on all the databases, including recovery databases, on the specified server. If you don't specify this parameter, the command returns logon statistics for the local server.

Type:ServerIdParameter
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
Applies to:Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019

-StoreMailboxIdentity

This parameter is available only in on-premises Exchange.

The StoreMailboxIdentity parameter specifies the mailbox identity when used with the Database parameter to return statistics for a single mailbox on the specified database. You can use one of the following values:

  • MailboxGuid
  • LegacyDN

Use this syntax to retrieve information about disconnected mailboxes, which don't have a corresponding Active Directory object or that has a corresponding Active Directory object that doesn't point to the disconnected mailbox in the mailbox database.

Type:StoreMailboxIdParameter
Position:1
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
Applies to:Exchange Server 2013, Exchange Server 2016, Exchange Server 2019

Inputs

Input types

To see the input types that this cmdlet accepts, see Cmdlet Input and Output Types. If the Input Type field for a cmdlet is blank, the cmdlet doesn't accept input data.

(Video) Exchange PowerShell Script: Get-MailboxReport.ps1 Demonstration

Outputs

Output types

To see the return types, which are also known as output types, that this cmdlet accepts, see Cmdlet Input and Output Types. If the Output Type field is blank, the cmdlet doesn't return data.

FAQs

How to get all mailbox properties in PowerShell? ›

Find the mailbox property that corresponds to the setting you're interested in by running the command Get-Mailbox -Identity "<MailboxIdentity" | Select-Object * to list all the properties of a mailbox.

How to get-MailboxStatistics size in PowerShell? ›

In PowerShell there is no separate cmdlet to find out Exchange mailbox size directly as it is considered as apart of mailbox statistics information. Hence, you must use the Get-MailboxStatistics cmdlet to find out the size of a particular mailbox. You can use the -Object <total item size> parameter for the same.

How do I get all mailbox permissions in PowerShell? ›

Use the Get-MailboxPermission cmdlet to retrieve permissions on a mailbox. Note: In Exchange Online PowerShell, we recommend that you use the Get-EXOMailboxPermission cmdlet instead of this cmdlet. For more information, see Connect to Exchange Online PowerShell.

How do I get-MailboxStatistics size for all users? ›

Information get mailbox size of all users PowerShell script
  1. Display in Exchange Management Shell.
  2. Export to CSV File.
  3. Export to CSV File (Specific to Database)
  4. Enter the Mailbox Name with Wild Card (Export)
  5. Enter the Mailbox Name with Wild Card (Display)
  6. Export to CSV File (OFFICE 365)
Mar 28, 2023

How do I see all mailboxes in Exchange? ›

Navigate to Exchange Server > Mailboxes > General Reports > Mailbox Enabled Users report (for Exchange Server).

How do I get all properties of a service in PowerShell? ›

How to get all properties and methods available for the service in PowerShell? To display all the properties and methods available for the get-service cmdlet you need to pipeline Get-Member (alias gm). MemberType 'Property' is to display the specific property like machinename, servicename, etc.

What is the PowerShell command to get mailbox size for all users o365? ›

To view mailbox size, you can use the Get-MailboxStatistics cmdlet with the mailbox identity.

How to check inactive mailbox size PowerShell? ›

You can use the Get-MailboxStatistics cmdlet along with suitable parameters to fetch the list of inactive Exchange mailboxes. You can also specify the period of inactivity as required. Using this cmdlet, you can find out all users last logon time.

How to check mailbox folder size through PowerShell? ›

Use the Get-MailboxFolderStatistics cmdlet to retrieve information about the folders in a specified mailbox, including the number and size of items in the folder, the folder name and ID, and other information.

How do I view mailbox rules in Exchange PowerShell? ›

Use the Get-InboxRule cmdlet to view Inbox rule properties. Inbox rules are used to process messages in the Inbox based on conditions specified and take actions such as moving a message to a specified folder or deleting a message.

How do I access my Exchange mailbox permissions? ›

In the admin center, go to the Users > Active users page. Select the user you want, expand Mail Settings, and then select Edit next to Mailbox permissions. Next to Read and manage, select Edit. Select Add permissions, then choose the name of the user or users that you want to allow to read email from this mailbox.

How do I get the size of a folder and all contents in PowerShell? ›

You can use the Get-ChildItem ( gci alias) and Measure-Object ( measure alias) cmdlets to get the sizes of files and folders (including subfolders) in PowerShell.

How do I increase mailbox size in Exchange Management Shell? ›

In the EAC, navigate to Recipients > Mailboxes. On the mailbox properties page, click Mailbox Usage, and then click More options. Click Customize the settings for this mailbox, and then set the following boxes. The value range for any of the storage quota settings is from 0 through 2047 gigabytes (GB).

How do I increase mailbox size in Exchange PowerShell? ›

Set mailbox quota for all users in an organization
  1. Connect to Exchange Online PowerShell.
  2. Run the following PowerShell cmdlet: PowerShell Copy. Get-Mailbox | Set-Mailbox -ProhibitSendQuota <Value> -ProhibitSendReceiveQuota <Value> -IssueWarningQuota <Value>
Feb 13, 2023

How do I get mailbox folder permissions in PowerShell? ›

Use the Get-MailboxFolderPermission cmdlet to view folder-level permissions in mailboxes. Note: In Exchange Online PowerShell, we recommend that you use the Get-EXOMailboxFolderPermission cmdlet instead of this cmdlet. For more information, see Connect to Exchange Online PowerShell.

What to do when Exchange mailbox is full? ›

In Outlook, choose File> Cleanup Tools > Mailbox Cleanup.
...
Here are some ways to keep your mailbox size under control:
  1. Archive older items – Move old items you want to keep to an archive. ...
  2. Empty the Deleted Items folder – Empty the Deleted Items folder frequently to make sure you aren't keeping messages you don't need.

How to force Outlook to display all your emails from your Exchange mailbox? ›

More information
  1. Start Outlook.
  2. On the File tab, click Account Settings, and then click Account Settings.
  3. On the E-mail tab, double-click your Microsoft Exchange account.
  4. In the Change Account dialog box, drag the Mail to keep offline slider to the desired number of months or to All to synchronize all email messages.
Jul 21, 2022

How do I get all loaded modules in PowerShell? ›

The Get-InstalledModule cmdlet gets PowerShell modules that are installed on a computer using PowerShellGet. To see all modules installed on the system, use the Get-Module -ListAvailable command.

How do I get all Exchange servers in PowerShell? ›

Use the Get-ExchangeServer cmdlet to view the properties of Exchange servers. When you run the Get-ExchangeServer cmdlet with no parameters, it returns the attributes of all the servers in the Exchange organization.

How do I get full output in PowerShell? ›

All you have to do is to go to Out-String and add the -Width parameter. Keep in mind that the -Width parameter of Out-File cmdlet specifies the number of characters in each line of output. Any other characters will simply be truncated, not wrapped.

How to check all mailbox size in Office 365 admin console? ›

In the admin center, go to the Reports > Usage page. Select View More under Email activity. From the Email activity drop-down list, select Exchange > Mailbox usage.

How do I check the size of my mailbox in Exchange Management Console? ›

In Microsoft Exchange Server, you can check the mailbox size individually for every mailbox, under the General tab and in Exchange Online the same can be viewed under the Mailbox usage tab.

How do I see mailbox size in Exchange Admin Center? ›

Checking the size of a user's Office 365 mailbox is easy, but the path in the Exchange admin center may not be intuitive for you.
  1. From the Exchange admin center, click mailboxes under recipients.
  2. Select the user whose mailbox size you want to check.
  3. Click the edit icon (looks like a pencil).
  4. Select mailbox usage.

What is the difference between get-mailbox and get-MailboxStatistics? ›

Get-Mailbox will only return the SoloUser, while Get-MailboxStatistics will return the mailbox, the archive mailbox , and the system mailbox. As you can see Get-MailboxStatistics tend to be more realistic by looking at all and every mailbox in the database.

How do I know if my mailbox is full service? ›

Choosing Between Full-Service and Limited-Service Mailboxes

Only full-service mailboxes have a carrier signal flag. The USPS allows full-service mailboxes to use any color for the carrier signal flag except green, brown, white, yellow, blue and shades thereof.

What is the PowerShell command for mailbox rules? ›

The following cmdlets are used to manage mailbox rules in Exchange:
  • Get-InboxRule.
  • New-InboxRule.
  • Enable-InboxRule.
  • Disable-InboxRule.
  • Set-InboxRule.
  • Remove-InboxRule.
Feb 15, 2023

How do I count mailboxes in Exchange Online PowerShell? ›

You can find the total mailboxes count in Exchange Admin Center. Navigate to recipients > mailboxes. You will find the total mailbox count at the bottom.

How to check folder and subfolder size in Windows using PowerShell? ›

If you want to get the file/folder size in a specified directory, you can refer to the following command. For example, to get the size of the C:\Windows10Upgrade folder, you can run the Get-ChildItem C:\Windows10Upgrade | Measure-Object -Property Length -sum command.

What is the command to check mailbox database size? ›

Run Get-MailboxDatabase command which will bring two properties, namely: Database size and AvailableNewMailboxSpace. Make use of “Status” parameter in the above command so that the values could be fetched.

How do I see all file properties in PowerShell? ›

If you want to get all properties of a file in Windows PowerShell, you can use the "Get-Item ... | Select-Object -Property *" pipeline.

How to get all object properties values in PowerShell? ›

To get the properties of an object, use the Get-Member cmdlet. For example, to get the properties of a FileInfo object, use the Get-ChildItem cmdlet to get the FileInfo object that represents a file. Then, use a pipeline operator ( | ) to send the FileInfo object to Get-Member .

How do I expand all properties in PowerShell? ›

The PowerShell Expand Property switch can only expand one property at a time, in contrast to the Property switch, which can select more than one property simultaneously. Execute the variable name, $testServices , to view the structure of its contents.

How do I list mailboxes in PowerShell? ›

Use the Get-Mailbox cmdlet to view mailbox objects and attributes, populate property pages, or supply mailbox information to other tasks. Note: In Exchange Online PowerShell, we recommend that you use the Get-EXOMailbox cmdlet instead of this cmdlet.

Videos

1. Basic PowerShell commands for Shared Mailboxes in Exchange Online #Microsoft #PowerShell
(TechTrip)
2. Find the mailbox sizes And Export Exchange 2013 PowerShell
(Yaniv Totshvili)
3. Windows PowerShell - How to - Microsoft Exchange Server Recipients
(Heiko Horn)
4. EMS : Create reporting on the mailbox size
(microsoft lab)
5. View User Mailbox Size Using PowerShell Exchange Server 2016
(NTWEEKLYCOM)
6. Executing Exchange 2010 PowerShell Activities using Ayehu eyeShare
(Ayehu (Now Part of Resolve))
Top Articles
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated: 14/05/2023

Views: 5937

Rating: 4.1 / 5 (52 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.