Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bad mail folder 18

Status
Not open for further replies.

jbead

IS-IT--Management
Jun 28, 2002
74
0
0
US
where do I find this folder on my exchange folder? how do I manually clean it because I was told that I should reboot when done. Thanks

JBead
 
The badmail folder is located here:

c:\exchsrvr\mailroot\vsi 1\badmail

You can clean this by creating a bat file. Here is a bat file that I use:

____________________________________________________
net stop smtpsvc
cd "c:\exchsrvr\mailroot\vsi 1"
ren badmail badmailold
cd "c:\exchsrvr\mailroot\vsi 1\badmailold"
del *.*
cd "c:\exchsrvr\mailroot\vsi 1"
rmdir badmailold
md BadMail
net start smtpsvc

______________________________________________________
So open up notepad, copy this into the notepad, save the file with a .bat extension. Save this to the root of C. Then do the following:

(1) Go to a dos prompt
(2) Run the .bat file (whatever you named the file) by typing xxxxx.bat (xxxxx=file name.bat).

* note that you will be prompted to delete the directory badmailold. Just reply "y".

What this bat file will do is this:

(1) stops the smtp service.
(2) Changes directory to the vsi 1 directory
(3) Renames badmail folder to badmailold
(4) Deletes all files in the badmail old folder
(5) Creates new BadMail folder
(6) Starts the SMTP Service.

I run this command once a week. The badmail folder will get huge if you don't.

 
Also, YOU DO NOT HAVE TO REBOOT. WHOEVER TOLD YOU THIS IS WRONG
 
Why do you do all of that zoeycat? I just set my batch file to delete everything in the badmail folder every morning and it's been working great for months now. I don't do all that renaming and recreating.

I'm Certifiable, not certified.
It just means my answers are from experience, not a book.
 
What works for you Lander is great. I'm not doing all that work. I simply run the bat file. The bat file does everything for me and it takes all of 30 seconds to run. How much work is that? And also this is the way Microsoft recommends so i'm just following their instructions.


Whatever works.
 
Take it easy, deep breath...ok, let's try this again.

I was curious as to why you had your batch file creating directories, renaming directories, and stopping/starting the SMTP service, that's all. That's a alot of stuff going on versus simply deleting everything in the \badmail folder from a bat file. (and btw, I didn't say anything about doing all that "work", simply doing all that)

You say MS recommends this? Ok, that's cool, can you tell me where they recommend this? I'm curious because when you stop/start the SMTP service, you temporarily inhibit the ability of your exchange server to receive email, that's all. I try to keep my starting/stopping to a complete minimum. If MS recommends it, they usually have a reason, and I'd like to research this and perhaps mod my routine.

I'm Certifiable, not certified.
It just means my answers are from experience, not a book.
 
thanks so much for the bat file. I was told that you should stop and start the services as well and that it should be done at night. I will implement this right away. thanks,

JBead
 
Lander,

I'm taking a deep breath now. Phew...Thanks for the advice. Feel better now.

I've troubleshooted this issue with Microsoft. That is how I know because I was experiencing the same problems with the badmail queue and opened a case with Microsoft regarding this. I won't go into every detail of the notes but this is the recommended way of clearing the badmail queue. Here are some notes from the Microsot Tech regarding the bat file I should create
________________________________________________________
There's no way to automate this process that I know of other than to write a batch file to go through these same steps. The batch file might look like this, assuming that your Exchange files are on the E drive:

Net stop smtpsvc
cd "e:\program files\exchsrvr\mailroot\vsi 1"
Ren badmail badmailold
Move badmailold \\server\share\badmailanalysis
Md badmail
Net start smtpsvc
_________________________________________________________

Hope I answered your question? The script I listed works for me in my environment. There are no articles referencing this script. But there is an article in MCP Magazine (Boswell's Q+A) that gives this same exact script. And as I noted the SMTP Service is stopped for about 30 seconds. I could see if this process took several minutes then it would be a concern.
 
Just a footnote, if you add /Q to the end of your rmdir command, it will not prompt you anymore... Thanks for the batch...

Thanks,

Matt Wray
MCSE, MCSA, MCP, CCNA

 
Matt,

Thanks for that. (Wasn't sure of that. I will add that to my script)
 
Matt,

Cheers...Thanks for the Star.....I did place that /Q to the end of the rmdir line and I still get prompted with the, "Do you really want to purge". I don't mind replying "Y" but any idea why the /Q did not work for me? I have a simple .bat file.
 
Matt,

Disregard. I added the /Q to the del*.* line.

Works great.

Thanks
 
Well, I can't leave a good script alone. In order to shave a few seconds off the actual time that SMTP is down, I changed the order of the script a little.

setlocal ENABLEDELAYEDEXPANSION
cd "C:\Program Files\Exchsrvr\Mailroot\vsi 1\"
echo !time!
net stop smtpsvc
ren badmail badmailold
md BadMail
net start smtpsvc
echo !time!
del badmailold\*.* /Q
rmdir badmailold
echo !time!

This makes it where SMTP is only down for 6 seconds on our server, then the delete of badmailold occurs. This shaved about 30 seconds off the time that the service was unavailiable.
 
I will have to add this to my script as well. 6 seconds is much better than 30.

Thanks
 
Jtmoore,

Very nice....Just tried the script. It took me about 15 seconds for it to complete but still better than the 30 seconds or so it was taking me before.
 
how about in a cluster environment e2k/SP3 wind 2k /SP4
active/active cluster

thanks

Ray
 
Yes it works in a cluster environment, but obviously the script needs to be changed as the commands are different for taking a resource offline.
 
Thanks guys, it works good under .cmd or .bat extensions as well.
Regards,
 
Well guys...microsofts says this can't be automated? why not..just set a scheduled task at night to run the batch file...runs great...

Thanks, PAUL

 
Guys and Girls,
I know I am a litlle late but let me tell you that you are the best.
Just wanted to express my thanks to all of you, for taking the time to help others and myself included.

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top