Ben Sullivan

Founder at Ayrne
Artist, Traveler, and Lover of the Beauty of Life

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 [email protected] | select FolderPath, FolderSize, ItemsinFolder, ItemsInFolderandSubfolders | Export-csv example.csv

 

That’s it, you’re done!

Tags:

About the Author
Founder , Ayrne
I am an artist, traveler, and lover of the beauty of life
  • Show Comments (1)

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Barton Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
newest oldest most voted
Notify of
Jason Barton
Guest
Jason Barton

Thanks, this was just what I was looking for!

Support our site

If you find this site helpful, please consider using our affiliate links. Ayrne may earn a small commission from your purchase, but it won’t cost you anything at all and in some cases, it may even save you money! We use affiliate links instead of banner ads to provide you with a cleaner, more focused experience on our website.