Remove one email from Exchange 2007
I just thought of sharing a cmdlet which every exchange pro should have handy.
User Arnold sends an email to a set of people with the subject line “I am back”. Now, Stallone being the IT manager wants you to delete that email from the server side.
All you gotta do is to run this cmdlet:
Get-Mailbox -Server EXCH | Export-Mailbox -TargetMailbox TempMailbox -TargetFolder ” To Delete” -SenderKeywords arnold@terminator.com -SubjectKeywords ” I am back ” –StartDate “12/30/10” –EndDate “12/31/10” -ExcludeFolders “\Calendar”, “\Contacts”, “\Deleted Items” –DeleteContent –MaxThreads 10
Conditions:
- Server name is EXCH
- Data will be extracted from user mailboxes to the folder “To Delete” in a mailbox called TempMailbox
- Start date and End Date switch let you choose a date range
- Set the ExcludeFolders switch if you don’t want to search specific folders
- DeleteContent is the switch which deletes the email
- MaxThreads is to specify 10 mailboxes will be processed at a time
Now remember that Export-Mailbox first copies content to the destination mailbox before performing the search and the target mailbox can get quite large and create heavy IO. This is different from creating a transport rule to filter incoming messages.
Users can still use the “Recall” option in outlook.
–
Ratish Nair
MVP Exchange
Team@ MSExchangeGuru
KeyWords: Delete one email from Exchange, delete one email from all mailboxes, cmdlet to delete one emails from mailboxes, how to delete one email message in exchange, Powershell command to delete one email in exchange 2007.
December 31st, 2010 at 11:51 pm
Pretty cool one !! Ive made a note of it….
Scott
January 9th, 2011 at 12:22 pm
its very nice, as one administrator it is must to know with prectical
January 26th, 2012 at 8:22 am
Cool one. however, i am having problem with above command ExportMailbox:string missing???
any help plzzz….
March 11th, 2012 at 6:44 am
Dear Ratish Nair Sir.
Sir. we need, how to delete a specific mail message from all exchange server 2007 mailbox user users.
Please can you tell me complete Processor step by step.
Thanks Regard.
March 3rd, 2014 at 7:41 pm
[…] a single message from an exchange 2007 server can be done a couple ways from the Exchange Shell. This blog uses a good method, and combined with the information on this forum, I have developed a “go […]
April 4th, 2014 at 3:19 am
Dear Sir,
On my SBS 2008 server with Exchange 2007 in the Event log, I get every 5 min this warning;
One or more messages (1) can not be sent from name@domain.be-account on the POP3-server mail.domain.be
because they are bigger than maximal allowed. (Message size is 11558403 bytes.) and so one.
In get-transportconfig is Maxsendsize and Maxreceivesize set to 25MB
The MaxSendSize in the smtp connector is set to 25Mb (hase been resized after that error in the hope that…)
In the clients Mailbox on his workstation there is nothing of that kind of mail to find.
In the queue viewer I can’t see any mail
How can I delete this mail and stop that resending every 5 min.
Thanks for your help
Dany