Checking the exchange email numbers
Posted by Miksu22@reddit | sysadmin | View on Reddit | 18 comments
Hi,
We recently encountered a problem where one of our employees email inboxes reached their maximum capacity. My supervisor told me to check how many emails each employee has, including the CEO, and to enforce company-wide policies to keep it under the maximum limit per user. I feel like people use their deleted folders as an "archive" for things, so I would like to check if they are full of stuff before I start purging them. I am operating from a Mac, but we mainly use Windows. I tried to check this using PowerShell, but I received an error when trying to access our Exchange server. I have the necessary admin rights to assign "read and manage" rights to anyone's inbox, but I am concerned that I might get into trouble for doing so, especially because we are also subject to EU user privacy laws. We don't have an Azure subscription to use cloud-based PowerShell. I normally do network stuff, so I'm a bit lost with this one, to be honest. Any ideas how to proceed from here?
I am running macOS 26.5.0 and powershell 7.6.2.
I tried to use devicecode and usedeviceauthentication, but neither of those worked.
BarracudaDefiant4702@reddit
It's been awhile when I dealt with exchange (different team now), but we used to have it set so deleted items were auto-purged after 30 days. That way it's good for short term archive (ie: missed an email from a week ago and have to track it down), but doesn't allow it to build up too much...
Miksu22@reddit (OP)
Yeah I was thinking to do it with 30 days from the moment it will be deleted from any other folder and leave there 15 days period until its completely gone. Later getting rid of that 15 days out of there when everyone is used to that it will purge after a month has passed. I just would like to know if someone has like tens of thousands of emails in the deleted folder so I could ask him/her is it just okay to purge it all after a month or does he/she need more time to sort it out. At the moment it will purge them after five years.
Candid_Ad5642@reddit
Yeah, this is the way
Just make sure everyone knows this is coming, with some time to fix before you implement (and keep backup or something because there will be users who will not understand)
tankerkiller125real@reddit
Might take throwing important documents into end user trash bins to show them why it's a dumb idea to store important documents in the trash on their computer to get the point across.
Had to do it with three end users for the concept of "trash is not an archive" to finally get it across.
Candid_Ad5642@reddit
Yeah, we implemented this at a previous workplace, and one of our key account managers had a decade of customer correspondence in the "quick archive"
Not sure where he got the idea that the trashcan was delete, not just "I'm done with this, so archive it"...
mixduptransistor@reddit
Who normally manages your Exchange environment? Maintaining mailboxes vs. their quota is an extremely basic function, so whoever is managing Exchange should be doing this
I suspect I know what the answer to my question is going to be, though
Miksu22@reddit (OP)
The guy who is on vacation for next five week...
BarracudaDefiant4702@reddit
Probably the OP, at least the team he is on.
purplemonkeymad@reddit
You need to connect to exchange online, I don't think the latest macOS is fully supported from the latest Powershell Module, so you might need to investigate the authentication options. Try with -DeviceCode if your CA policies allows it, otherwise you might need to setup certificate authentication with an enterprise app for it.
Then you want to use Get-MailboxFolderStatistics. That will show you folders in the mailbox and the item count/usage. Not sure that you'll be able to tell between never empting deleted and using it as an archive tbh. No full access permissions needed to use this command, just exchange roles.
PinkertonFld@reddit
Being EU and having some legal retention issues, look into Mailstore, it's a fantastic mail archiver that meets EU and Sarbanes-Oxley (USA) needs for archiving. I've ran it here for over a decade, and basically have only 3 months on the email server, and 10 years in the archive, has a plugin so they can search... (and it's much, much faster than outlooks interal search and Archive). I just run it on a virtual machine. Works great.
https://www.mailstore.com
ddadopt@reddit
+1 for Mailstore, also been using more than ten years.
PunDave@reddit
Purview content search should have some stuff for this- you can index items and sizes without seeing into the items directly, and you need particular roles to export it, you can assign to only have reas view to the data.
But 50 gb is a lot of space to fill for exchange online 1. In the 365 admin report menu you can also get an overview of how big each mailbox is without any insight into the data itself. That lö help you understand if its 5, 10 or 1 user hitting any limits.
Ummgh23@reddit
OP wrote exchange server. Why are you assuming exchange online? Not every org has gone M365..
Ummgh23@reddit
Exchange Management Shell…
UserProv_Minotaur@reddit
Usually you want to set and enforce a retention policy (usually one year) for all mailboxes and build exception policy groups for folk like legal and C-suite due to litigation/discovery requirements.
But I'd definitely check with legal before doing anything to make sure you know what your company's requirements are.
TechIncarnate4@reddit
It's not about how many emails they have. A few with large attachments could be the problem. It's more about the mailbox size, not "how many" they have. What is the mailbox quota set for each user today?
If you want anyone to be able to help, you will need to share details on what that error message is.
WheresNorthFromHere7@reddit
First before you take any actions you need to get some CYA under your belt.
So, build out your plan. Understand the outcomes. Present this to management and have them understand the outcomes.
Let them decide if this is going to be the best course of action or not.
Some things you will want to look into:
Archiving emails. If you blindly set a quota (limit) you'll likely lock people out of sending/receiving email. Be careful. Get their mailboxes within your proposed limits.
How to use the exchange management shell (assuming on prem). Stick to "Get" commands until you have a good idea of how things work. You can use the -whatif switch as well.
Quotas. Set whatever they want the company policy to be for each mailbox
Management should communicate these changes, but be ready for the fallout.
bubbaganoush79@reddit
I can't comment on EU privacy laws. I don't know what that covers.
I can tell you that you're going to need to get Exchange PowerShell up and running to find the information that's been requested. This article should get you there: https://learn.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell?view=exchange-ps
Once you get connected to Exchange Online PowerShell, you're going to be using Get-MailboxFolderStatistics on each mailbox. There's no way to get that data in aggregate that I'm aware of. So you'll have to write a script to get all mailboxes in the environment, Get-MailboxFolderStatistics on each one of them, to find how many items are in their Deleted Items folder, and aggregate the results into a variable that you can then export.