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?
2 Answers
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.
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!
I'll check what the CSV output looks like and see if that helps.

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