Get Help With a PowerShell Script for Sent and Received Email Counts
Question details
The user needs a PowerShell script to count sent and received emails for selected users within a date range.

- Product
- PowerShell
- Device & OS
- not provided
- Scenario
- Create a report of email activity for specific users and dates.
- Observed behavior
- The desired report should show sent and received email counts for the selected users and period.
Identify your mail system, the users to include, and the date range and time zone for the report. Decide whether the counts should include internal messages and how messages with multiple recipients should be counted.
Request Script Guidance From a Microsoft Technical Community
Use a dedicated technical forum to get commands and filtering logic suited to your mail system.
List your mail system, such as Exchange Online or an on-premises mail server, the user identifiers, the date range, and the desired output format.
Copy any script you have tried and note the errors or unexpected results. Remove credentials, access tokens, and sensitive user data before posting.
Go to Microsoft Q&A at https://learn.microsoft.com/en-us/answers/, select Ask a question, and include your requirements and sanitized code. Add relevant PowerShell and mail-system tags.
Run the suggested script with appropriate permissions and compare its results with a small, known set of messages before reporting on all selected users.

Review Email Count Reports With WPS Spreadsheets
WPS Office is a free, lightweight alternative with a familiar interface and Microsoft Office format compatibility for an easy transition. Use WPS Spreadsheets to review an exported email count report; it does not create or fix the PowerShell script.

Frequently Asked Questions
What information should I include in my scripting question?
Include the mail system, selected user identifiers, date range and time zone, desired output, and any existing script or error message. Remove credentials and sensitive information before posting.
Can the same PowerShell script work for every mail system?
Not necessarily. Commands, permissions, and available message data vary by mail system, so identify your service when asking for help.
Why might a report not cover the entire date range?
The mail system may no longer retain the required message data, or your account may lack access to it. Check the relevant retention settings and permissions for your data source.
Can I open the resulting report in WPS Office?
Yes. If the script exports a CSV or Excel workbook, open that file in WPS Spreadsheets to review and organize the counts.




