{"id":2132,"date":"2017-05-16T21:22:54","date_gmt":"2017-05-16T21:22:54","guid":{"rendered":"http:\/\/microsoftgeek.com\/?p=2132"},"modified":"2017-05-16T21:22:54","modified_gmt":"2017-05-16T21:22:54","slug":"how-to-delete-emails-from-mailboxes-in-exchange-2010-using-search-mailbox","status":"publish","type":"post","link":"https:\/\/microsoftgeek.com\/?p=2132","title":{"rendered":"How to Delete Emails from Mailboxes in Exchange 2010 Using Search-Mailbox"},"content":{"rendered":"<p>Quick post today.\u00a0 If you have an criteria of emails that you want to delete from all mailbox\u2019s you can use Search-Mailbox to delete the message from users mailbox.\u00a0 For example, you get hit with a virus email that has the subject \u201cI am a virus\u201d from the user virussender@virus.com.<\/p>\n<p>The below search goes through all mailbox\u2019s and deletes any email with the subject \u201cI am a virus\u201d:<\/p>\n<p>&nbsp;<\/p>\n<table border=\"0\" width=\"1076\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"1074\"><strong>get-mailbox | Search-Mailbox -SearchQuery \u2018subject:\u201dI am a virus.\u201d \u2018 -TargetMailbox \u201cadminmailbox\u201d -TargetFolder \u201cDeleteVirus\u201d -LogLevel Full \u2013DeleteContent<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>That above command will delete the emails from the users mailbox\u2019s and copy them to the <strong>adminmailbox<\/strong> in the folder <strong>DeleteVirus<\/strong><\/p>\n<p>The next search does it based on the sender of the email:<\/p>\n<table border=\"0\" width=\"1096\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"1094\"><strong>get-mailbox | Search-Mailbox -SearchQuery \u2018from:virussender@virus.com \u2018 -TargetMailbox \u201cadminmailbox\u201d -TargetFolder \u201cDeleteVirus\u201d -LogLevel Full \u2013DeleteContent<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>The above search does the same thing as the first, except this query does it based on the from address of the sender versus the subject.<\/p>\n<p>If you log into the admin mailbox, you can see the results of the search and log files for it:<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"image\" src=\"http:\/\/port25guy.com\/wp-content\/uploads\/2013\/11\/image_thumb.png\" alt=\"image\" width=\"772\" height=\"116\" border=\"0\" \/><\/p>\n<p>You can also run the same commands without the \u2013<strong>DeleteContent<\/strong> switch to copy the messages to the admin mailbox for review before running the commands to delete.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Quick post today.\u00a0 If you have an criteria of emails that you want to delete from all mailbox\u2019s you can use Search-Mailbox to delete the message from users mailbox.\u00a0 For example, you get hit with a virus email that has the subject \u201cI am a virus\u201d from the user virussender@virus.com. The below search goes through [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,22],"tags":[],"class_list":["post-2132","post","type-post","status-publish","format-standard","hentry","category-exchange-2007","category-exchange-2010"],"_links":{"self":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2132"}],"version-history":[{"count":1,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2132\/revisions"}],"predecessor-version":[{"id":2133,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2132\/revisions\/2133"}],"wp:attachment":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}