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

Trubianska, Juliana 46 Reputation points


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:

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
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,175 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 45,186 Reputation points

    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