question

TJG091-2944 avatar image
0 Votes"
TJG091-2944 asked ZhengqiLou-MSFT commented

Determining retention policies for all users in O365

I am running into incomplete data being returned when running the command, Get-mailbox -ResultSize Unlimited | select Name, RetentionPolicy | export-csv c:\ncs\retention-365.csv -not.

I am running this in Exchange Online Powershell to get retention policies assigned to all users

I have run the command multiple times but get different results each time. We have about 16k users in O365 and I am only getting results for 6600. Subsequent runs of the command give me results of 4500, 3800.

What am I missing?

windows-server-powershelloffice-exchange-server-administrationoffice-exchange-hybrid-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

michev avatar image
0 Votes"
michev answered ZhengqiLou-MSFT commented

It's likely that your PowerShell session is timing out. Try the new REST-based cmdlets, which should be more robust: https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps

 Get-EXOMailbox -ResultSize Unlimited -Properties RetentionPolicy | select Name, RetentionPolicy 

You can also try running it in smaller batches, by filtering the users say per department, etc. Or simply try from a different machine/network, 16k should take just few minutes to return.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @TJG091-2944 ,

I would agree with michev, and in addition, you could remove the module and re-install it to test.

Best regards,
Lou

0 Votes 0 ·

Hi @TJG091-2944 ,

Do the suggestions above help? If the issue has been resolved, please click “Accept as answer” to mark the helpful reply as an answer, this will make answer searching in the forum easier and be beneficial to other community members as well.

If you are still stuck in this issue, please feel free to post your questions.

Regards,
Lou


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 Votes 0 ·