Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Delete an email sent to all users Exchange 2007 Powershell

Posted on 2013-12-26
5
Medium Priority
?
2,064 Views
Last Modified: 2014-01-27
I need to delete an emailsent by a disgruntled employee to all of our users. We are running Exchange 2007. How can I do this in Powershell?

Also, I know that tne Export-Mailbox is used in this task, does that command move or copy all of the users mailbox? What does this command actually do and why is it sometimes used with Get-Mailbox and sometimes it is not?

Thanks
0
Comment
Question by:wayy2be
  • 2
  • 2
5 Comments
 
LVL 14

Expert Comment

by:comfortjeanius
ID: 39740393
Export-Mailbox cmdlet to export or delete messages
; it has plenty of examples to perform this action.

White Paper: Remove Specific Messages from Exchange Server or Removing specific messages from your Exchange Server
0
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39740871
You can use the following syntax below to accomplish this...

Get-Mailbox -ResultsSize "Unlimited" | Export-Mailbox -TargetMailbox <MailboxName> -TargetFolder <FolderName> -SubjectKeyWords "your subject here" -DeleteContent

Open in new window


You can also use the below link for different syntax as well.
http://technet.microsoft.com/en-us/library/aa998579(v=exchg.80).aspx

Will.
0
 

Author Comment

by:wayy2be
ID: 39741044
The email has an attachment and I need to filter it with the attachment name. Also what are your thoughts on the second part of the question?

<<Also, I know that tne Export-Mailbox is used in this task, does that command move or copy all of the users mailbox? What does this command actually do and why is it sometimes used with Get-Mailbox and sometimes it is not?>>
0
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 2000 total points
ID: 39741101
You use the get-mailbox command in conjunction with export-mailbox when you want to search for all mailboxes. If you don't use the get-mailbox command you have to specify a specific mailbox. Also with the delete content it will actually delete the email from the specified mailboxes using the deletecontent switch. As for the attachment I do not believe there is a switch for this (I'll have to double check). You can use subject or keyword search or even from a specific sender.

Will.
0
 

Author Closing Comment

by:wayy2be
ID: 39813994
Sorry for the delay!  Thanks
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
If you have come across a situation where you need to find some EDB mailbox recovery techniques, then here you will find the same. In this article, we will take you through three techniques using which you will be able to perform EDB recovery. You …
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
This video discusses moving either the default database or any database to a new volume.

772 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