Office 365 User Statistics with PowerShell
Use this SAM application monitor template to track the statistics of Exchange mailboxes of Exchange Online server using PowerShell scripts.
Prerequisites
WMI access to the target server
See also Connect to Exchange Online Using Remote PowerShell (© 2020, Microsoft Corp, available at https://docs.microsoft.com/, obtained on February 3, 2020)
Run the PowerShell script mentioned in the Microsoft article on the SolarWinds Platform server, not the target node.
Credentials
- An SolarWinds Platform account with SAM administrator permissions.
- An Office 365 account with Global Administrator privileges.
An alternative account with an admin role can be used if it meets the following requirements.- The account must be a member of an Office 365 admin role.
- The account has adequate rights to subscriptions and management groups, as well as access to the Office 365 API.
- The account should be an all-in-one, inclusive account to support the monitoring of all mailboxes.
Use UPN format (username@domain
) — 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.
Tip: Consider using one of the new SAM API Poller templates designed for Microsoft 365 instead of legacy application monitor templates.
Component monitors
Recipient Statistics Report
This component monitor returns recipient statistics report which include the following:
- Total Number Of Mailboxes;
- Total Number Of Active Mailboxes;
- Number Of Contacts;
- Number Of Distribution Lists.
Total Items Count
This component monitor returns the total number of emails on the server.
Total Items Size (MB)
This component monitor returns the total mail size on the server in 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
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
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