Recipe7.16.Deleting Messages from the Badmail Folder


Recipe 7.16. Deleting Messages from the Badmail Folder

Problem

You need to delete messages from the badmail folder of your Exchange virtual server.

Solution

Using a graphical user interface

First, run the Badmail Delete and Archival script (BadmailAdminTool) with default parameters:

  1. Download the BadmailAdminTool from:

    http://www.microsoft.com/downloads/details.aspx?familyid=782aaf0f-6239-40ad-adda-97863d852ff7&displaylang=en

  2. Extract it to a directory of your choice.

  3. Open a command prompt and navigate to the BadmailAdminTool directory.

  4. Run the following command:

    > cscript.exe badmailadmin.wsf

Next, schedule the BadmailAdminTool script to run with default parameters:

  1. Open Scheduled Tasks (All Programs Accessories System Tools Scheduled Tasks).

  2. Browse to the directory where you installed the BadmailAdminTool and select badmailadmin.wsf.

  3. Leave the default task name. Select a schedule for the new task: Daily, Weekly, Monthly, One time only, When my computer starts, or When I log on and click Next.

  4. Provide the scheduled time and day to run the script on and click Next.

  5. Provide a user account with local administrative and Exchange Administrator rights to run the script and click Next.

  6. Check the Open advanced properties for this task when I click Finish checkbox and click Finish.

  7. Modify the task to provide the specific script parameters you desire.

Discussion

When Exchange encounters a fatal error during a delivery attempt, it generates an NDR for the original sender and attempts to deliver it. NDRs are messages like any other and work through the same link and queue system. In time, NDRs themselves may prove to be undeliverable. When that happens, Exchange moves the original message to the badmail folder, which is, by default, located underneath the root mail queue folder for the virtual server instance (see Recipe 7.15 for more information on queue folders).

Over time, the badmail directory can fill up and eventually cause space issues. You should check this directory on a regular basis and move or delete messages from it. Microsoft provides the BadmailAdminTool for download from their Exchange Tools download web site. It works with both Exchange 2000 and Exchange Server 2003. You can get it at http://www.microsoft.com/downloads/details.aspx?familyid=782aaf0f-6239-40ad-adda-97863d852ff7&displaylang=en.

The BadmailAdminTool provides the parameters shown in Table 7-7.

Table 7-7. BadmailAdminTool parameters

Parameter

Description

-a [delete|archive|disable]

The action to take when the badmail folder exceeds the size limit:


delete

Deletes all files


archive

Archives the files to the provided archive directory (the -p option) and delete them from the badmail folder


disable

Disables the use of the badmail folder

-v [<VS instance #> | all]

Specifies which virtual server badmail folder to run against. All is the default.

-f [OLDEST | LARGEST]

Specifies whether to move oldest or largest messages until the size limit is reached.

-l [OFF | VERBOSE | EVENTS]

Logging level:


OFF

Enables minimal logging


VERBOSE

Enables maximum logging for troubleshooting


EVENTS

Logs to the Event Viewer

-m <maximum folder size (MB)>

The badmail folder will be removed of any badmail that exceeds this limit; a value of 0 allows the script to delete all badmail.

-p <archive path>

Folder to hold archived badmail messages (see -a archive).

-s <server name>

The name of the Exchange server.


There are other methods of dealing with the badmail folder: The "Dealing with Badmail" entry (http://hellomate.typepad.com/exchange/2003/07/dealing_with_ba.html) on the MS Exchange Blog gives a short description of the badmail folder and provides an alternate script, the Badmail Report Tool. The Badmail Report Tool provides a weekly report of the contents of the badmail folder via email. You can download it from http://hellomate.typepad.com/exchange/badmailreport.zip.

As of Exchange Server 2003 SP1, the badmail folder is disabled out of the box, but you can re-enable it with selected registry tweaks per MS KB 884068.

See Also

Recipe 7.15 for more information on queue folders, and MS KB 884068 (The Badmail folder is disabled in Exchange Server 2003 SP1)



Exchange Server Cookbook
Exchange Server Cookbook: For Exchange Server 2003 and Exchange 2000 Server
ISBN: 0596007175
EAN: 2147483647
Year: 2006
Pages: 235

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net