Export-mailbox search question
We have a request to search all of our mailbox databases for just a couple of search terms. When we export the searched data to a .pst file and open it, it breaks the user mailboxes down into folders but also has every subfolder within the user mailboxes under every users mailbox name. We only want the folders in which there is pertinent data in it to show up NOT every folder in every user mailbox. Any scripts that would help and/or examples would be greatly appreciated.
May 26th, 2011 9:53am

Which version of Exchange are you running and please provide a sample of the command you are runningTroy Werelius www.Lucid8.com
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2011 12:14pm

Exchange 2007 Enterprise $olApp = new-object -com Outlook.Application $namespace = $olApp.GetNamespace("MAPI") #Root folder to match, look in your outlook and look at what folders you have. #RooFolders could be Mailbox - <username>, Public folders, or other mapped in PST's or mailboxes. $RootfolderToMatch = "Personal Folders" $Global:StopValue = 1 Function ListEmpty { Param ($infolder) Foreach ($fldr in $infolder.Folders) { If ($fldr.Items.Count -eq 0 -and $fldr.Folders.Count -eq 0) { # I have had to check for system folders, these cannot be deleted via the script, so to prevent the script for erroring out, I check for it. if ($fldr.name -match "Deleted Items") #if ($fldr.name -match "Slettet" -or $fldr.name -match "Deleted" -or $fldr.name -match "journal" -or $fldr.name -match "rss"` # -or $fldr.name -match "note" -or $fldr.name -match "kalender" -or $fldr.name -match "kontakt" -or $fldr.name -match "udbakke" ` # -or $fldr.name -match "Sync" -or $fldr.name -match "Server" -or $fldr.name -match "contacts" -or $fldr.name -match "Outbox" ) {"Cannot delete systemfolder : " + $fldr.FolderPath # } Else { if ($fldr.Parent.name -notmatch "slettet" -and $fldr.Parent.name -notmatch "Deleted" ) { #Remove # from the below line, to actually delete Outlook folders. "Deleting : " + $fldr.FolderPath $fldr.delete() $Global:StopValue = 0 } } } Else { if ($fldr.name.length -gt 0) { ListEmpty($fldr)} } } } date # print date and time $RootFolders = $namespace.Folders | ?{$_.name -match $RootfolderToMatch} Listempty($RootFolders) While ($Global:StopValue -eq 0) { $Global:StopValue = 1 Listempty($RootFolders) } date # print date and timeJames D. Lowry jlowry@scopelitis.com 317-492-9285
May 26th, 2011 3:42pm

Hi James, It seems related with some development, please post it on below forum: http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/threads Regards! Gavin TechNet Subscriber Support in forum If you have any feedback on our support, please contact tngfb@microsoft.com Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2011 5:10am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics