Wednesday, July 09, 2008

Cool method for cleaning test Exchange databases

We really like it that we deal with smart people.

Case in point: Adam Smith at Yale who created a script called ‘clean-mailbox-database-sumatra.ps1’ that finds the databases on 'your-server' and dismounts them. It then finds and removes all *.edb files in e:\mailbox and then mounts the databases.

clean-mailbox-database-sumatra.ps1:
________________________________________________________________________
#Find all mailbox databases on your-server and dismount them
Get-MailboxDatabase -server your-server Dismount-Database -Confirm:$False

#Find all of the .EDB files and remove them
Get-ChildItem -Path e:\mailbox -Recurse -Include *.edb Remove-Item

#start all mailbox databases
Get-MailboxDatabase -server your-server Mount-Database
________________________________________________________________________

This would not be something to do on your production system (unless you REALLY wanted to clean it), but for a test lab dedicated to a calendar migration it's faster and easier than our selective Undo.

Many thanks, Adam!

No comments: