List all mail folders for a specified user to easily locate a missing folder

0

If you have ever seen these user requests, then this simple PowerShell script is for you:

  • I’ve dragged my mail folder and now I cannot find it anymore;
  • I’ve clicked on something, and now the folder is gone;
  • I haven’t done anything, but that folder was here yesterday.

These types of requests are not an issue if you are dealing with a user who has several folders in addition to the standard ones. However, it’s not that uncommon for a user to have a hundred of them or even more. This is when manually searching for a lost folder turns into something big.

What this PowerShell script does, it shows all mailbox folders for a specified user and the path each one of those folders has. The result is shown in a Grid View that allows you to sort and search/filter. So simply search for a name your user told you about, once found, let the user know where it is “hidden”.

This script could have a part where it searches for a missing folder name and then displays only those that match the search criteria. To me it sounds like reinventing the wheel because you can have that search capability out of the box using a Grid View.

$answer = Read-Host "Please provide user's email address"

Get-MailboxFolderStatistics  -Identity $answer | Select Name,FolderPath,FolderSize,FolderAndSubfolderSize | out-gridview

$answer1 = Read-Host "Another email OR n (to cancel)?"

While ("n" -notcontains $answer1) {
	
	Get-MailboxFolderStatistics  -Identity $answer1 | Select Name,FolderPath,FolderSize,FolderAndSubfolderSize | out-gridview
	Write-host `n	
	$answer1 = Read-Host "Another email OR n (to cancel)?"
	
}

Remove-Variable * -ErrorAction SilentlyContinue
0

Leave a Reply

Close Menu