Deleting an e-mail sent to all users from exchange 2007
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
ExchangeOutlookEmail Servers
Last Comment
Gospodin Rasputin
8/22/2022 - Mon
Will Szymkowski
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
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.
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
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 Rasputin
ASKER
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 Szymkowski
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.
As Will said, use PST. Either mailbox or PST you need to export it somewhere in 2007.
Gospodin Rasputin
ASKER
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 Szymkowski
Just use a the -PSTFolderPath switch. You cannot use the same mailbox as the Target mailbox.
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 Rasputin
ASKER
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 Szymkowski
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.
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.