This quick, easy to follow guide will help you to export a CSV file listing all of the mail items within their respective folders and sub-folders. This script will work on both Exchange and O365.

    To get started in O365, you’ll need to open a remote powershell session:

     

    $o365cred=get-credential
    
    

     

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $o365cred -Authentication Basic -AllowRedirection

     

    Import-PSSession $session

     

    Then run this script to export to a file:

     

    get-mailboxfolderstatistics -identity jimbob@example.com | select FolderPath, FolderSize, ItemsinFolder, ItemsInFolderandSubfolders | Export-csv example.csv

     

    That’s it, you’re done!

    Tags:

    Support our ad free experience

    You May Also Like

    Robots With the Power to Take Life

    While robots with the capabilities to determine whether or not to take human life ...

    Xperia XZ Premium Performance Test

    The following performance comparison was obtained by installing GeekBench 4 on a new Xperia ...

    This is the Most Beautiful Linux Distro

    Linux has been top of the charts in functionality, security and stability for ages. ...