Forum Discussion

Maher Ramadan's avatar
Maher Ramadan
Brass Contributor
Jan 22, 2022

only | Export-csv is having an issue exporting the data, the rest of the PS works fine

i run the below against a CSV file and works fine on exchange online PS, foreach($m in $mailboxes) {Get-MailboxStatistics $m.Identity.ToString() |select Identity, displayname, LastLogonTime, itemcou...
  • Maher Ramadan's avatar
    Maher Ramadan
    Jan 23, 2022
    The append didn’t work for me guess it is used to add more than one get- to the same file

    However the other approach extracting the results then exporting them worked just fine, thank you


    $Results = foreach($m in $mailboxes) {Get-MailboxStatistics $m.Identity.ToString() |select Identity, displayname, LastLogonTime, itemcount, totalitemsize; Start-Sleep -Milliseconds 500}
    $Results | Export-CSV -Path " D:\123.csv" -NoTypeInformation

Resources