Version 1

    Office 365 User Statistics with PowerShell

    This template tracks the statistics of Exchange mailboxes of Exchange Online server using PowerShell scripts

     

    • Recipient Statistics Report
    • Total Items Count
    • Total Items Size (MB)
    • Specific User Items Count
    • Specific User Items Size (MB)
    • Test User MAPI Connectivity

     

    Prerequisites:

    • Windows PowerShell needs to be configured to run scripts
    • Check the following article for prerequisites:

    http://technet.microsoft.com/en-us/library/jj984289(v=exchg.150).aspx

     

    Credentials:

    • The user should have SAM Administrator permissions
    • Office 365 account with global administrator privileges.
      1. Microsoft has a Global Throttling Policy which limits simultaneous connections from one client for O365 to maximum three simultaneous connections”. The Scripts are designed to allow only 3 connections at a time, hence advise users to create and use an account for SAM monitoring only and nowhere else

     

    MONITORED COMPONENTS

    • Recipient Statistics Report
      • This component monitor returns recipient statistics report which include the following:
        • Total Number of Mailboxes (Unit: Number)
        • Total Number of Active Mailboxes (Unit: Number)
        • Number of Contacts (Unit: Number)
        • Number of Distribution Lists (Unit: Number)
    • Total Items Count
      • This component monitor returns the total number of emails on the server.
      • Unit: Number
    • Total Items Size (MB)
      • This component monitor returns the total mail size on the server in MB.
      • Unit: MB
    • Specific User Items Count
      • This component monitor returns the number of emails for the specified user.
      • You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor.
      • This monitor requires the following argument:
        • user_name
        • where:
          • user_name – target username;
          • Example: john
      • Unit: Number
    • Specific User Items Size (MB)
      • This component monitor returns the mailbox size for the specified user in MB.
      • You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor.
      • This monitor requires the following argument:
        • user_name
        • where:
          • user_name – target username;
          • Example: john
      • Unit: MB
    • Test User MAPI Connectivity
      • This component verifies that a specified mailbox can connect by using the MAPI protocol, which is used by Microsoft Office Outlook.
      • By default, this monitor is disabled.
      • Possible returned values:
        • 0 – Test failed. See message field for errors.
        • 1 – MAPI Test successfully finished.
        • You must specify the correct arguments in the Script Arguments field of the corresponding PowerShell Monitor.
      • This monitor requires the following argument:
        • user_name
        • where:
          • user_name – target username;
          • Example: john
      • Unit: Boolean

     

    Troubleshooting steps

    Detail troubleshooting steps (common for template)

    • Use UPN format (username@domain) and not domain\username format to enter credentials. Also, a service account for Exchange Web Services is recommended to avoid authentication issues when passwords are updated.

     

    Detail troubleshooting steps (specific for components if any)

    • Microsoft has a Global Throttling Policy which limits simultaneous connections from one client for O365 and maximum three simultaneous connections are allowed”. To overcome this concurrency issue, we have implemented Locking mechanism and restricted 3 Scripts establishing a connection with Office-365, hence Sometimes scripts may take more time to fetch data, to handle such situation try to increase polling and time interval.
      • Error: “Fail to create a runspace because you have exceeded the maximum number of connections allowed: 3 for the policy party: MaxConcurrency. Please close existing runspace and try again.”

     

    Portions of this document were originally created by and are excerpted from the following sources:https://docs.microsoft.com/en-us/powershell/module/exchange/devices/get-mobiledevice?view=exchange-ps