Issues with Fetching Enabled User Mailboxes in PowerShell

0
5
Asked By CuriousCoder45 On

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

Answered By TechieGuru88 On

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.

CuriousCoder45 -

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

Answered By ScriptSlinger99 On

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!

CuriousCoder45 -

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

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.