Deleting an e-mail sent to all users from exchange 2007

Gospodin Rasputin
Gospodin Rasputin used Ask the Experts™
on
Someone has just mistakenly sent an e-mail to all users. Is there anyway I can remove all unread copies of this e-mail before the weekend is over?

I know I could attempt to reacall/replace the e-mail, but I'm afraid this depends on the recipient agreeing to the recall. Is there a way my Exchange admins can remove this message from the Exchange Information Store using the message ID?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Will SzymkowskiSenior Solution Architect
Most Valuable Expert 2015
Top Expert 2015

Commented:
You can use the Export-Mailbox cmdlet to accomplish this. See the below script...
Get-Mialbox -ResultSize "Unlimited" |
Export-Mailbox -PSTFolderPath "C:\pstfiles\filename.pst" -BadItemLimit 1000000 -ContentKeywords "CLICK HERE TO Upgrade" -DeleteContent -Confirm:$false

Open in new window


The above script will get all mailboxes and export the results to a pst file and delete the email from all of the mailboxes where "Click Here To Upgrade" is in the body or the subject line.

Will.
AmitIT Architect
Distinguished Expert 2017

Commented:
In 2007, you can use export-mailbox cmd let to search and delete specific email. Here is MS KB with all required steps:
http://blogs.technet.com/b/exchange/archive/2010/10/27/3411398.aspx
Gospodin RasputinIT  Manager

Author

Commented:
Hi Amit,
I'm using the following but it seems to be complaning because I have not specified thethe target mailbox.

Get-Mailbox -ResultSize Unlimited | Export-Mailbox -ContentKeywords "REC_2999.wmv" -StartDate "15/06/2010" -EndDate "18/06/2010" -DeleteContent

But I wish to just remove the message without copying it to anywhere else.

Any idea? I suspect maybe I should remove the |Export -Mailbox from the command.

The error I get on all the mailboxes is as follows:

Export-Mailbox : Error was found for Udojil Alexander (Udojil.Alexander@mydomain.o
rg.uk) because: Error occurred in the step: Moving messages. Failed to copy messages to the destination mailbox store with error:
MAPI or an unspecified service provider.
ID no: 00000000-0000-00000000, error code: -1056749164
At line:1 char:51
+ Get-Mailbox -ResultSize Unlimited | Export-Mailbox <<<<  -ContentKeywords "RE
C_2999.wmv" -StartDate "15/06/2010" -EndDate "18/06/2010" -DeleteContent
    + CategoryInfo          : InvalidOperation: (540:Int32) [Export-Mailbox],
   RecipientTaskException
    + FullyQualifiedErrorId : E05CA502,Microsoft.Exchange.Management.Recipient
   Tasks.ExportMailbox
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

AmitIT Architect
Distinguished Expert 2017

Commented:
In 2007 that was the limitation, which is removed in 2010 or above. You need to provide target mailbox. You can create or use test mailbox as target mailbox. Later, you can clean up target mailbox.
Gospodin RasputinIT  Manager

Author

Commented:
What should the name of the target mailbox be? What format? The usernames format? Not exactly sure how mailbox is names in Exchange 2007...will try the username format and see.
Thank you
Will SzymkowskiSenior Solution Architect
Most Valuable Expert 2015
Top Expert 2015

Commented:
It is not a requirement for a mailbox. You can use just use a PST file instead, as I have illustrated in my first post.

Will.
AmitIT Architect
Distinguished Expert 2017

Commented:
As Will said, use PST. Either mailbox or PST you need to export it somewhere in 2007.
Gospodin RasputinIT  Manager

Author

Commented:
Tried to specify target mailbox and it is telling me the source and target are the same.

I thought the cmd searches for any messages marching the criteria and deletes it. Does it search in the target mailbox only!!
My Command is : Get-Mailbox -ResultSize Unlimited | Export-Mailbox -ContentKeywords "REC_2999.wmv" -TargetMailbox TEST -TargetFolder 'DeleteMsg' -DeleteContent

The new error message is:
Export-Mailbox : The source mailbox 'Test' and target mailbox 'Test' are the same, and is not supported by this command.
At line:1 char:51
+ Get-Mailbox -ResultSize Unlimited | Export-Mailbox <<<<  -ContentKeywords "RE
C_0002.wmv" -TargetMailbox Test -TargetFolder 'DeleteMsg' -DeleteContent
    + CategoryInfo          : InvalidArgument: (155:Int32) [Export-Mailbox], R
   ecipientTaskException
    + FullyQualifiedErrorId : B7EE2B39,Microsoft.Exchange.Management.Recipient
   Tasks.ExportMailbox
Will SzymkowskiSenior Solution Architect
Most Valuable Expert 2015
Top Expert 2015

Commented:
Just use a the -PSTFolderPath switch. You cannot use the same mailbox as the Target mailbox.

Will.
Gospodin RasputinIT  Manager

Author

Commented:
OK Will. I'll try that and let you know.
Thanks for your help.
Murali ReddyExchange Expert

Commented:
Because it searching the Test mailbox too, when you have not specified in the filter, just exempt it.

Makwe sure you aslways specify a date range, otherwise the command deletes any old messages matching the subjected criteria.

Something like..

Get-Mailbox -ResultSize Unlimited |Where-Object {!($_.Alias -eq "Test")} |Export-Mailbox -ContentKeywords "REC_2999.wmv" -StartDate "15/06/2010" -EndDate "18/06/2010" -TargetMailbox TEST -TargetFolder 'DeleteMsg' -DeleteContent
AmitIT Architect
Distinguished Expert 2017

Commented:
I assume you got the answer already. You need to exclude this mailbox.
Gospodin RasputinIT  Manager

Author

Commented:
Hi Will,
Please can you expand your command for me. I am trying to search all the inbox in my information store for a mesage titled "REC_2999.wmv" and delete them all.

In your command, is -PSTFolderPath "C:\pstfiles\filename.pst" the source where you are deleting from or the destination (target folder where you are deleting to?

I just looked at your command and it confused me now, maybe

Thank you
Gospodin RasputinIT  Manager

Author

Commented:
Hi Will/ Amit,
When I use the -PSTFolderPath switch, it complains about me using a 64bit system and the command being for 32bit system with outlook 2003 installed in it.

Any other suggestions?
Thank you
Will SzymkowskiSenior Solution Architect
Most Valuable Expert 2015
Top Expert 2015

Commented:
In Exchange 2007 this is another limitation as you will need to use a 32bit workstation to export the items to a PST file. Use a 32bit client machine.

Will.
Gospodin RasputinIT  Manager

Author

Commented:
And on a 32bit client machine, how do I run the Exchange shell?
I was running these commands on the Exchange 2007n Server.
Thank you
Will SzymkowskiSenior Solution Architect
Most Valuable Expert 2015
Top Expert 2015

Commented:
You need to install the 32bit Management Tools for Exchange 2007.  Once you have that installed you will be able to export to PST with no issues.

Will.
Gospodin RasputinIT  Manager

Author

Commented:
Where do i install this tool? On the exchange Server or ona workstation.
Thank you
Senior Solution Architect
Most Valuable Expert 2015
Top Expert 2015
Commented:
Workstation. Launch the Exchange 2007 Media on a workstation, and when you get to the screen to install the roles, just select the management tools.

Once this is installed the re-run the script.

Will.
Gospodin RasputinIT  Manager

Author

Commented:
Hi Will,
I shall try this and let you know.
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial