Issues with Fetching Enabled User Mailboxes in PowerShell

November 30, 2025 2 answers
Asked by banjo lesson
I'm trying to get a list of only the enabled user mailboxes using PowerShell, but I'm running into some issues. My command often hangs or gives me a 0B CSV file. Here's the syntax I'm using: Get-ExoMailbox -RecipientTypeDetails UserMailbox -ResultSize unlimited | Where-Object {$_.Enabled -eq $true} | Get-MailboxRegionalConfiguration | Export-Csv C:mailbox.csv Should I be using -Filter instead of Where-Object for better performance? Also, is it better to use Get-Mailbox instead of the newer Exo command?

Answers

soft pretzels
It might help to check how many mailboxes you're querying. Your current command is retrieving all mailboxes which can be slow. Consider using a -Filter approach for efficiency. That could speed things up!

banjo lesson: I'll check what the CSV output looks like and see if that helps.

Reply to this answer
two-way-street
Have you tried running your command without 'Get-MailboxRegionalConfiguration'? That could be causing the hang, especially if it's waiting for a property that isn't there for all mailboxes.

banjo lesson: I actually need that part! I got it working without it, and the CSV ended up being around 200KB.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions