Get-EXOMailbox -> How to obtain all mailboxes with pagination

Trubianska, Juliana 46 Reputation points
2024-04-30T09:33:18.1533333+00:00

Hi,

I am using cmdlet Get-EXOMailbox -resultSize unlimited. But this return a lot of data and it take a lot of time. I would like to use some skip or nextLink but it is not working.

I tried this: Get-EXOMailbox | select-object -Skip 10 -First 10 according this source: https://morgantechspace.com/2015/06/powershell-get-mailbox-resultsize.html

But i have an error Get-EXOMailbox: The pipeline has been stopped.

Exist for this cmdlet some batch? Or any other options how to obtain all exoMailboxes with pagination?

Thanks for answer.

Microsoft Exchange Online
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,125 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 45,106 Reputation points
    2024-04-30T15:37:46.2533333+00:00

    For how long does that query run? There are limits within a session that will terminate the query after a time (I think it's one hour, by default).

    But I think you're probably better off partitioning your search. One way to do that is to use the -RecipientTypeDetails to get only mailboxes of a certain type in each query. Another way would be to use the -Filter parameter.


0 additional answers

Sort by: Most helpful