I have spent a few hours figuring out how to delete messages from a mailbox in a particular date range in Exchange 2010. Still I wasn't able to find out a correct PowerShell script to do it.
So I dropped all the messages with the cmdlet Get-Mailbox | Search-Mailbox -DeleteContent
.
Although 5GB should have been deleted (Statistics show that the required mailboxes are now empty), it didn't free up space on a hard drive that contains my Exchange Database.
Is there any SQL-like stuff I need to do, to "Commit" the delete transaction?
Best Answer
What you're looking for is an offline defrag. The command
eseutil /d
will get you what you need. See the linked Microsoft KB.Please note that when doing this, you want to put your temporary database on a different partition that has the same amount of free space that your current exchange DB has.