?
Solved

whats the command to delete an email from all mailboxes in exchange 2007 sp2

Posted on 2012-03-13
13
Medium Priority
?
314 Views
Last Modified: 2012-06-27
i need to delete an email from every mailbox
0
Comment
Question by:dougdog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
13 Comments
 
LVL 21

Expert Comment

by:Hendrik Wiese
ID: 37714052
Export and delete all messages that contain "TEST Subject" in their subject from all mailboxes from the DB1 database to a folder called "TEST DATA" in the Administrator mailbox:

Get-mailbox -database 'DB1' | export-mailbox –SubjectKeywords "TEST Subject" -TargetFolder "TEST DATA" -TargetMailbox Administrator –DeleteContent 

Open in new window


And ensure that you have the correct permission as per the following article: http://www.kevintaber.com/2009/06/09/search-for-and-delete-emails-in-exchange-2007-mailboxes-using-powershell/

Hope this helps!!
0
 
LVL 15

Expert Comment

by:Rajkumar-MCITP
ID: 37714067
Same as above mentioned command, To search it from all the mailbox and you dont want to have a backup of those emails

Get-mailbox -ResultSize unlimited| export-mailbox –SubjectKeywords "TEST Subject" –DeleteContent
0
 

Author Comment

by:dougdog
ID: 37714328
is it meant to move all the emails with test subject to a folder in the specified mailbox
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
LVL 21

Expert Comment

by:Hendrik Wiese
ID: 37714339
Yes that is what it does and after it moved all the messages it will delete them. ;)
0
 

Author Comment

by:dougdog
ID: 37714345
can i get it to not delete them id rather do it manually im afraid of this deleting more data that its mean to
0
 

Author Comment

by:dougdog
ID: 37714349
i was going to use this command its the only one i can seem to get working

Get-Mailbox -Server EXCHSVR01 | Export-Mailbox -SubjectKeywords “Confidential reports” -StartDate “06/09/2009¿ -DeleteContent
0
 
LVL 21

Expert Comment

by:Hendrik Wiese
ID: 37714356
Then run the command like this to move it to the administrator mailbox

Get-mailbox -database 'DB1' | export-mailbox –SubjectKeywords "TEST Subject" -TargetFolder "TEST DATA" -TargetMailbox Administrator
0
 

Author Comment

by:dougdog
ID: 37714368
can i have it to run against the server as i have multiple databases
0
 
LVL 21

Expert Comment

by:Hendrik Wiese
ID: 37714431
Try the following:

Get-mailbox -ResultSize unlimited | export-mailbox –SubjectKeywords "TEST Subject" -TargetFolder "TEST DATA" -TargetMailbox Administrator
0
 

Author Comment

by:dougdog
ID: 37714609
when i run thsi the folder i created remains empty
0
 

Author Comment

by:dougdog
ID: 37714735
when i run this command it looks like it is deleting loads of mail
im a little worried its deleting more than i t should
Capture.PNG
0
 

Author Comment

by:dougdog
ID: 37714737
and the test data folder remain empty
0
 
LVL 21

Accepted Solution

by:
Hendrik Wiese earned 2000 total points
ID: 37714758
It will only populate the mailbox after the move is completed. Let me know when it is done running.
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A couple of months ago we ran into an issue that necessitated re-creating our Edge Subscriptions. However, when we attempted to execute the command: New-EdgeSubscription -filename C:\NewEdgeSub_01.xml we received an error indicating that the LDAP se…
One-stop solution for Exchange Administrators to address all MS Exchange Server issues, which is known by the name of Stellar Exchange Toolkit.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question