Forum Discussion

hdsouza1's avatar
hdsouza1
Copper Contributor
Nov 05, 2026
Solved

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...
  • VasilMichev's avatar
    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