Exchange 2007-2010 Statistics with PowerShell

Version 2

    This template tracks the statistics of Exchange mailboxes and the mailbox databases of Exchange 2007-2010 servers with the Mailbox role using PowerShell scripts.


    Prerequisites:

    • PowerShell 2.0 and Exchange Management Tools 2007 or 2010 installed on the SAM server.
    • The Exchange server must have an Exchange Mailbox role.
    • The SAM server and the Exchange server must  be in the same domain.


    Credentials:

    The credentials must be that of an Exchange Administrator (Organization Manager) account with at least view-only permissions.


    Monitored Components

    These component monitors are based on the following information:

     

    Note: Before using this template, under the Advanced tree collapse [+], you should set the correct platform; either 32 bit or 64 bit, from the dropdown menu. The default it set to 32 bit.

     

    Total mail size (MB)

    This component monitor returns the total mail size on the server in MB.

    Note: You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor. If you fail to do this, the counter will return with an error of "Undefined" status. Put arguments in the following order:

    Exchange_server_name,exchange_version,domain_controller_name

    where:
    Exchange_server_name – hostname or FQDN of target Exchange server;
    exchange_version – version of target Exchange server (2007 or 2010);
    domain_controller_name – hostname or FQDN of domain controller;

    Example:

    xchng2010.domain.com,2010,dc.domain.com

    To see the names of your Exchange servers, run the following command in the Exchange Management Shell: Get-ExchangeServer


    Total mailboxes

    This component monitor returns the total number of mailboxes on the server.

    Note: You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor. If you fail to do this, the counter will return with an error of "Undefined" status. Put arguments in the following order:

    Exchange_server_name,exchange_version,domain_controller_name

    where:
    Exchange_server_name – hostname or FQDN of target Exchange server;
    exchange_version – version of target Exchange server (2007 or 2010);
    domain_controller_name – hostname or FQDN of domain controller;

    Example:

    xchng2010.domain.com,2010,dc.domain.com

    To see the names of your Exchange servers, run the following command in the Exchange Management Shell: Get-ExchangeServer

     

    Total items in mailboxes

    This component monitor returns the total number of emails on the server.

    Note: You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor. If you fail to do this, the counter will return with an error of "Undefined" status. Put arguments in the following order:

    Exchange_server_name,exchange_version,domain_controller_name

    where:
    Exchange_server_name – hostname or FQDN of target Exchange server;
    exchange_version – version of target Exchange server (2007 or 2010);
    domain_controller_name – hostname or FQDN of domain controller;

    Example:

    xchng2010.domain.com,2010,dc.domain.com

    To see the names of your Exchange servers, run the following command in the Exchange Management Shell: Get-ExchangeServer

     

    Total size of specified database file (MB)

    This component monitor returns the total size of all mailboxes in the specified database in MB.

    Note: You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor. If you fail to do this, the counter will return with an error of "Undefined" status. Put arguments in the following order:

    Exchange_server_name,exchange_version,domain_controller_name,mailbox_database

    where:
    Exchange_server_name – hostname or FQDN of target Exchange server;
    exchange_version – version of target Exchange server (2007 or 2010);
    domain_controller_name – hostname or FQDN of domain controller;
    mailbox_database – target mailbox database name;

    Example:

    xchng2010.domain.com,2010,dc.domain.com,Mailbox Database

    To see the names of your mailbox databases, run the following command in the Exchange Management Shell: Get-MailboxDatabase

     

    Total mailboxes in specified database file

    This component monitor returns the number of mailboxes in the specified database.

    Note: You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor. If you fail to do this, the counter will return with an error of "Undefined" status. Put arguments in the following order:

    Exchange_server_name,exchange_version,domain_controller_name,mailbox_database

    where:
    Exchange_server_name – hostname or FQDN of target Exchange server;
    exchange_version – version of target Exchange server (2007 or 2010);
    domain_controller_name – hostname or FQDN of domain controller;
    mailbox_database – target mailbox database name;

    Example:

    xchng2010.domain.com,2010,dc.domain.com,Mailbox Database

    To see the names of your mailbox databases, run the following command in the Exchange Management Shell: Get-MailboxDatabase

     

    Items in mailbox of specified user

    This component monitor returns the number of emails for the specified user.

    Note: You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor. If you fail to do this, the counter will return with an error of "Undefined" status. Put arguments in the following order:

    Exchange_server_name,exchange_version,domain_controller_name,username

    where:
    Exchange_server_name – hostname or FQDN of target Exchange server;
    exchange_version – version of target Exchange server (2007 or 2010);
    domain_controller_name – hostname or FQDN of domain controller;
    username – target username;

    Example:

    xchng2010.domain.com,2010,dc.domain.com,john

    To see the names of your mailbox databases, run the following command in the Exchange Management Shell: Get-Mailbox

     

    Mailbox size of specified user (MB)

    This component monitor returns the mailbox size for the specified user in MB.

    Note: You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor. If you fail to do this, the counter will return with an error of "Undefined" status. Put arguments in the following order:

    Exchange_server_name,exchange_version,domain_controller_name,username

    where:
    Exchange_server_name – hostname or FQDN of target Exchange server;
    exchange_version – version of target Exchange server (2007 or 2010);
    domain_controller_name – hostname or FQDN of domain controller;
    username – target username;

    Example:

    xchng2010.domain.com,2010,dc.domain.com,john

    To see the names of your mailbox databases, run the following command in the Exchange Management Shell: Get-Mailbox

     

    Average items per mailbox

    This component monitor returns the average number of emails per mailbox based on a mathematical count.

    Note: You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor. If you fail to do this, the counter will return with an error of "Undefined" status. Put arguments in the following order:

    Exchange_server_name,exchange_version,domain_controller_name

    where:
    Exchange_server_name – hostname or FQDN of target Exchange server;
    exchange_version – version of target Exchange server (2007 or 2010);
    domain_controller_name – hostname or FQDN of domain controller;

    Example:

    xchng2010.domain.com,2010,dc.domain.com

    To see the names of your Exchange servers, run the following command in the Exchange Management Shell: Get-ExchangeServer

     

    Size of largest user mailbox (MB)

    This component monitor returns the size of the largest mailbox. You can see the user name for the assigned mailbox in the message field.

    Note: You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor. If you fail to do this, the counter will return with an error of "Undefined" status. Put arguments in the following order:

    Exchange_server_name,exchange_version,domain_controller_name

    where:
    Exchange_server_name – hostname or FQDN of target Exchange server;
    exchange_version – version of target Exchange server (2007 or 2010);
    domain_controller_name – hostname or FQDN of domain controller;

    Example:

    xchng2010.domain.com,2010,dc.domain.com

    To see the names of your Exchange servers, run the following command in the Exchange Management Shell: Get-ExchangeServer

     

    Dismounted mailbox databases

    This component monitor returns the number of dismounted mailbox databases. The last mailbox database to be dismounted is displayed in the message field.

    The name of the last dismounted database is taken from the list of databases and is not based on the actual time the database was dismounted. There is no database attribute that records the time it was dismounted.

    Note: You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor. If you fail to do this, the counter will return with an error of "Undefined" status. Put arguments in the following order:

    Exchange_server_name,exchange_version,domain_controller_name

    where:
    Exchange_server_name – hostname or FQDN of target Exchange server;
    exchange_version – version of target Exchange server (2007 or 2010);
    domain_controller_name – hostname or FQDN of domain controller;

    Example:

    xchng2010.domain.com,2010,dc.domain.com

    To see the names of your Exchange servers, run the following command in the Exchange Management Shell: Get-ExchangeServer

     

    Mounted mailbox databases

    This component monitor returns the number of mounted mailbox databases.

    Note: You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor. If you fail to do this, the counter will return with an error of "Undefined" status. Put arguments in the following order:

    Exchange_server_name,exchange_version,domain_controller_name

    where:
    Exchange_server_name – hostname or FQDN of target Exchange server;
    exchange_version – version of target Exchange server (2007 or 2010);
    domain_controller_name – hostname or FQDN of domain controller;

    Example:

    xchng2010.domain.com,2010,dc.domain.com

    To see the names of your Exchange servers, run the following command in the Exchange Management Shell: Get-ExchangeServer

     

    Portions of this document were originally created by and are excerpted from the following sources:
    Microsoft Corporation, “Technet Library,” Copyright © 2012 Microsoft Corporation.  All rights reserved. Available at
    http://technet.microsoft.com/en-us/library/bb691338.aspx and http://technet.microsoft.com/en-us/library/bb201689%28EXCHG.80%29.aspx