August 24, 2020 at 6:47 am #252104ParticipantTopics: 13Replies: 39Points: 306Rank: Contributor
I have a script which grabs the number of sent and received mails from our shared mailboxes on Exchange Online.
I’m getting the mailboxes via this command:PowerShell1Get-EXOMailbox -RecipientTypeDetails SharedMailbox -ResultSize Unlimited
However it seems I have to use the Get-Mailbox cmdlet as I can’t be sure that the new Get-EXOMailbox cmdlet actually returns anything.
On Friday I ran the script (with Get-EXOMailbox), and it worked perfectly and returned the statistics for our 400+ shared mailboxes.
I tried running the script again today, and it connected to ExOnline without problem, and I saw it importing the cmdlets but it ran in less than a second and the exported csv was 1kb and contained nothing.
I tried running the single Get-EXOMailbox cmdlet from PS directly and it returned nothing, at first I thought it was because I’d forgotten to run PIM and elevate my user, but I went through the elevation process without problem. I waited a while so the elevation had time to kick in through all the services and I restarted the powershell prompt and reran the script, but it still returned nothing. The script starts with a Get-PSSEssion | Remove-PSSession so it’s a new fresh session every time it runs, so nothing should be cached either.
Finally I tried changing the script to the old Get-Mailbox cmdlet instead and that ran through all of our shared mailboxes without issues.
I’ve seen similar behavior previously in an interactive Powershell prompt that the EXO commands, specifically the Get-EXOMailbox, but I’m pretty sure that I’ve seen it with Get-EXOMailboxStatistics as well.
I managed to get it working then by restarting both the Windows Terminal app and reconnecting to ExOnline, but nothing worked this morning.
I’m wondering if anyone else have experienced similar issues with the those cmdlets and know what to do to get them to work consistently.
- The topic ‘Inconsistent behavior from Get-EXOMailbox’ is closed to new replies.