Script to clean out the Bad mail directory
Added 6/22/2004: Here is a link to a Microsoft page with their recommendation for cleaning out the BadMail folder:
If the ..\Program Files\ExchSrvr\Mailroot\vsi 1\BadMail is filling up with lot's of files (.bad, .bdr., .bdp), you can simply delete them. However, it has been noted that if you have thousands of these files, simply deleting them may cause Exchange to slow to a crawl for awhile. It is therefore recommended to create a batch/command script that will clear this directory out. You can then schedule this scriupt to run daily or weekly, as required.
You may ask why this script doesn't simply delete the files, but instead renames and deltes directories. That's because of recommendations from Microsoft. Read more about this script at:
Here's the actual script:
cd "D:\Program Files\Exchsrvr\Mailroot\vsi 1\"
net stop smtpsvc
ren badmail badmailold
net start smtpsvc
del badmailold\*.* /Q
Note 1: You need to edit the file (see red) to reflect the drive where your Exchange folder exists
Note 2: The three “echo !time!” commands can be deleted, if desired.