MEPURGE just does not work.
MEPURGE just does not work.
I've tried several different settings, mepurge just seems to do whatever it wants.
MEPURGE ALL 1 DELETED - does nothing but tell me which files are older then 1 days.
MEPURGE domain.com 1 DELETED - does the same as above, it doesn't limit it to the domain at all, it scans all domains.
MEPURGE ALL 1 BADMAIL - doesn't even touch the badmail folder.
It's running on a win2k3 server, I don't know if that is messing it up, if that's the problem, is there another utility out there that I can use? (I'm really suprised there's nothing built in to the MMC for folders other then the inbox)
MEPURGE ALL 1 DELETED - does nothing but tell me which files are older then 1 days.
MEPURGE domain.com 1 DELETED - does the same as above, it doesn't limit it to the domain at all, it scans all domains.
MEPURGE ALL 1 BADMAIL - doesn't even touch the badmail folder.
It's running on a win2k3 server, I don't know if that is messing it up, if that's the problem, is there another utility out there that I can use? (I'm really suprised there's nothing built in to the MMC for folders other then the inbox)
strange behavior
Ok, I added UNREAD to the end of the command line, so it's as follows
MEPURGE ALL 30 DELETED UNREAD
and it deleted all mail in deleted folders, read or unread. It really doesn't matter if they are read or unread, as long as it's working.
The 30 doesn't do anything either, it deletes all deleted items, regardless if they are 1 day or 100 days old.
Someone from mail enable should really come up with a purge utility that works right.
MEPURGE ALL 30 DELETED UNREAD
and it deleted all mail in deleted folders, read or unread. It really doesn't matter if they are read or unread, as long as it's working.
The 30 doesn't do anything either, it deletes all deleted items, regardless if they are 1 day or 100 days old.
Someone from mail enable should really come up with a purge utility that works right.
MEPURGE Alternate
Personally I'm not real fond of the purge utility myself so I came up with an alternate method that serves me well so I thought I share.
But there are some points to remember; as far as I can tell the "Read" or "Unread" value is only associated with the web-mail object. So its not real useful to check against, considering that if your clients check their mail with any other client app then the web based email system. Then the value is useless . What I mean by that is if you check you email via Outlook or Outlook Express and read everything you have the web mail client couldn't care less and wont consider it read until you use the web app.
So to the point I don't use this value below, nor do I see a point attempting to use it.
To summarize I wrote a little vb-script to check the domain folders in ME to determine if the mail was older then 90 days if so copy it to my backup folder and deleting the original while keeping the parent structure so that it would be easier to find anything in the event I had a cranky user
Here is my script if anyone cares or would like to make use of it, I do plan on building in some other features shortly; like bad mail to outboud que and things similar to the orginal purge tool.
Comments and suggestions are most welcome!
But there are some points to remember; as far as I can tell the "Read" or "Unread" value is only associated with the web-mail object. So its not real useful to check against, considering that if your clients check their mail with any other client app then the web based email system. Then the value is useless . What I mean by that is if you check you email via Outlook or Outlook Express and read everything you have the web mail client couldn't care less and wont consider it read until you use the web app.
So to the point I don't use this value below, nor do I see a point attempting to use it.
To summarize I wrote a little vb-script to check the domain folders in ME to determine if the mail was older then 90 days if so copy it to my backup folder and deleting the original while keeping the parent structure so that it would be easier to find anything in the event I had a cranky user
Here is my script if anyone cares or would like to make use of it, I do plan on building in some other features shortly; like bad mail to outboud que and things similar to the orginal purge tool.
Code: Select all
Dim FSO, BackUpDir
Dim WshShell, BadMailKey, MailRoot, SMTPOutQ ,SMTPQfolder
Set FSO = createobject("scripting.filesystemobject")
Set WshShell = WScript.CreateObject("WScript.Shell")
BackupDir = "F:\BackupME" 'Change this to your desired backup location!
BadMailKey = WshShell.RegRead("HKLM\SOFTWARE\Mail Enable\Mail Enable\Bad Mail Directory")
MailRoot = WshShell.RegRead("HKLM\SOFTWARE\Mail Enable\Mail Enable\Mail Root")
DoSearch(MailRoot)
Function Dosearch(Path)
Set Folder=fso.getfolder(Path)
Set Files = folder.files
For Each File in files
If fso.GetExtensionName(file.path)="MAI" then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim DaysOld, ParentF, URDF
ParentF = File.ParentFolder
DaysOld = DateDiff("d", File.DateCreated, Now)
If DaysOld > 90 Then 'Number of days to check aginst
URDF = Split(ParentF, "\",-1, 1)
If FSO.FolderExists(BackupDir) Then
Else objFSO.CreateFolder(BackupDir)
End If
If FSO.FolderExists(BackupDir &"\"& URDF(3) ) Then
Else objFSO.CreateFolder(BackupDir &"\"& URDF(3) )
End If
If FSO.FolderExists(BackupDir &"\"& URDF(3)&"\"& URDF(4) ) Then
Else objFSO.CreateFolder(BackupDir &"\"& URDF(3)&"\"& URDF(4) )
End If
If FSO.FolderExists(BackupDir &"\"& URDF(3)&"\"& URDF(4)&"\"& URDF(5) ) Then
Else objFSO.CreateFolder(BackupDir &"\"& URDF(3)&"\"& URDF(4)&"\"& URDF(5) )
End If
If FSO.FolderExists(BackupDir &"\"& URDF(3)&"\"& URDF(4)&"\"& URDF(5)&"\"& URDF(6) ) Then
Else objFSO.CreateFolder(BackupDir &"\"& URDF(3)&"\"& URDF(4)&"\"& URDF(5)&"\"& URDF(6) )
End If
FSO.CopyFile File, BackupDir&"\"& URDF(3)&"\"& URDF(4)&"\"& URDF(5)&"\"& URDF(6) &"\", True
Else
End If
File.Delete 'Delete .mai file after its been backed Up.
end If
Next
Set Subfolders = folder.SubFolders
For Each Subfolder in Subfolders
Dosearch Subfolder.path
Next
end function
Ok thats embarrassing I posted bad code, my apologize to those who attempted to use this.. here is the corrected code. It seems I had it deleting in the wrong step.
Live and Learn I spose.
Code: Select all
Dim FSO, BackUpDir
Dim WshShell, BadMailKey, MailRoot, SMTPOutQ ,SMTPQfolder
Set FSO = createobject("scripting.filesystemobject")
Set WshShell = WScript.CreateObject("WScript.Shell")
BackupDir = "F:\BackupME" 'Change this to your desired backup location!
MailRoot = WshShell.RegRead("HKLM\SOFTWARE\Mail Enable\Mail Enable\Mail Root")
DoSearch(MailRoot)
Function Dosearch(Path)
Set Folder=fso.getfolder(Path)
Set Files = folder.files
For Each File in files 'File is the current file where we are
If fso.GetExtensionName(file.path)="MAI" then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim DaysOld, ParentF, URDF
ParentF = File.ParentFolder
DaysOld = DateDiff("d", File.DateCreated, Now) 'DateLastModified DateCreated
If DaysOld > 90 Then
Wscript.echo DaysOld
URDF = Split(ParentF, "\",-1, 1)
If FSO.FolderExists(BackupDir) Then
Else objFSO.CreateFolder(BackupDir)
End If
If FSO.FolderExists(BackupDir &"\"& URDF(3) ) Then
Else objFSO.CreateFolder(BackupDir &"\"& URDF(3) )
End If
If FSO.FolderExists(BackupDir &"\"& URDF(3)&"\"& URDF(4) ) Then
Else objFSO.CreateFolder(BackupDir &"\"& URDF(3)&"\"& URDF(4) )
End If
If FSO.FolderExists(BackupDir &"\"& URDF(3)&"\"& URDF(4)&"\"& URDF(5) ) Then
Else objFSO.CreateFolder(BackupDir &"\"& URDF(3)&"\"& URDF(4)&"\"& URDF(5) )
End If
If FSO.FolderExists(BackupDir &"\"& URDF(3)&"\"& URDF(4)&"\"& URDF(5)&"\"& URDF(6) ) Then
Else objFSO.CreateFolder(BackupDir &"\"& URDF(3)&"\"& URDF(4)&"\"& URDF(5)&"\"& URDF(6) )
End If
FSO.CopyFile File, BackupDir&"\"& URDF(3)&"\"& URDF(4)&"\"& URDF(5)&"\"& URDF(6) &"\", True
fso.DeleteFile(file)
Else
End If
end If
Next
Set Subfolders = folder.SubFolders
For Each Subfolder in Subfolders
Dosearch Subfolder.path
Next
end function
Thanks for the VB Script. I may take a look at this. I also found that using ROBOCOPY can be effective in moving old mail too - you can specify a minimum age in days.
ROBOCOPY won't delete things, but you can MOVE them out of certain folders and into a DELETE directory somewhere and then use the RD (remove directory) command to "purge".
I can post my batches if anyone is interested.
I also use ROBOCOPY to manage the logs.
ROBOCOPY won't delete things, but you can MOVE them out of certain folders and into a DELETE directory somewhere and then use the RD (remove directory) command to "purge".
I can post my batches if anyone is interested.
I also use ROBOCOPY to manage the logs.
I use "forfiles" to do things like this -- I believe it comes with the Windows Resource Kit (it's just an .exe you throw in \WINNT\system32). Every night, my "Delete Old Logs.bat" file runs, which contains this line:
forfiles -p"C:\Program Files\Mail Enable\Bad Mail" -m"*.mai" -c"cmd /c if @ISDIR==FALSE del 0x22@PATH\@FILE0x22" -d-30 -s
It deletes all files in the Bad Mail folder (-p...) and below (-s) which end .mai (-m"*.mai") and are older than 30 days (-d-30). Simple
forfiles -p"C:\Program Files\Mail Enable\Bad Mail" -m"*.mai" -c"cmd /c if @ISDIR==FALSE del 0x22@PATH\@FILE0x22" -d-30 -s
It deletes all files in the Bad Mail folder (-p...) and below (-s) which end .mai (-m"*.mai") and are older than 30 days (-d-30). Simple
Re: MEPURGE Alternate
[quote="Mother
Comments and suggestions are most welcome![/quote]
Forgive my ignorance of VB Scripting, but when I executed this script from a command prompt, I get what appears to be a pop up window for every action the script is taking. The window is titled "Windows Script Host" and displays a seemingly random number and the ok button.
I'm assuming this is some sort of feedback from the script or perhaps a message count for each folder it scans.
How can I turn this off? A setting for Windows Script Host? Or is the script intended to run in a batch file or MTA pickup event? Will it run the entire script without expecting responses from the console? I was planning on setting this up as a schedule task once a month, but don't want to do that until I know that it will work without user intervention.
This is a great script though...it appears to be working just fine except for these interactive windows popping up. Kudos to the author.
Comments and suggestions are most welcome![/quote]
Forgive my ignorance of VB Scripting, but when I executed this script from a command prompt, I get what appears to be a pop up window for every action the script is taking. The window is titled "Windows Script Host" and displays a seemingly random number and the ok button.
I'm assuming this is some sort of feedback from the script or perhaps a message count for each folder it scans.
How can I turn this off? A setting for Windows Script Host? Or is the script intended to run in a batch file or MTA pickup event? Will it run the entire script without expecting responses from the console? I was planning on setting this up as a schedule task once a month, but don't want to do that until I know that it will work without user intervention.
This is a great script though...it appears to be working just fine except for these interactive windows popping up. Kudos to the author.
Yes you want to run this paticular script via a batch file, that is excatly what I've done with a scheduled task.
MailCleanup.bat
I've have an update to this script that uses the winzip command line module to archive the old email and date stamps the files before it removes them from the system, that way I can CYA . As soon as I get a chance this evening I'll post that as well.
MailCleanup.bat
Code: Select all
cscript.exe filename.vbs
Re: MEPURGE just does not work.
Adding to an old thread.
Nothing in this post works.
MEPURGE doesn't work
Agent doesn't work
HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Nothing in this post works.
MEPURGE doesn't work
Agent doesn't work
HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!