Forum Discussion
hdsouza1
Nov 05, 2026Copper Contributor
Get-MgReportMailboxUsageDetail fails with : Cannot access a closed Stream
Since Nov 3 at 10 PM EST Get-MgReportMailboxUsageDetail fails with "Cannot access a closed Stream" The command used is : Get-MgReportMailboxUsageDetail -Period D7 -OutFile C:\Temp\test.csv Has anyo...
- Nov 05, 2026
Works fine here, perhaps some temporary issue?
You can always get the data as JSON instead, and use Export-CSV against it:
$a = Invoke-MgGraphRequest -Uri "https://graph.microsoft.com/beta/reports/microsoft.graph.getMailboxUsageDetail(period='D7')?`$format=application/json" -OutputType PSObject $a.value | Export-Csv D:\Downloads\temp.csv
hdsouza1
Nov 05, 2026Copper Contributor
Thanks VasilMichev.
That command worked, although it gave me only 200 users (Pagination).
Although I noticed you are using the "Beta" version.
I just tried installing the corresponding Get-MgBetaReportMailboxUsageDetail and that worked as well for all 42K users
Then I went and updated graph modules from 2.29.1 to 2.41.2 and with that Get-MgReportMailboxUsageDetail also works now.