Exchange 2010 PowerShell Command to Delete a single email database

Leo
Leo used Ask the Experts™
on
Can anyone please assist me for an exchange powershell command, i want to delete a specific email address from a database from last week and onwards, means from that particular email address we want to delete it from a database anything we receive a week back.
we are running exchange 2010.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
LeoSnr Network Eng

Author

Commented:
and before running this command, is it possible that i would know how much space i will gain after deleting that particular email address from the database?
Antonio VargasMicrosoft Senior Cloud Consultant

Commented:
use the search-mailbox command:

http://technet.microsoft.com/en-us/library/dd298173.aspx

use it maybe with the sent sintax on the search query. something like this:

Search-Mailbox -Identity "April Stewart" -SearchQuery 'sent:19/10/2010' -DeleteContent

do it first without the -deletecontent to check the output and then add the delete content.
Antonio VargasMicrosoft Senior Cloud Consultant

Commented:
use the get-mailboxstatistics to check the space:

http://technet.microsoft.com/en-us/library/bb124612.aspx
LeoSnr Network Eng

Author

Commented:
can you please clear out to me how can i define dates, lets say i want to delete email from user@hotmail.com starting from last week upto 5 years back.
Antonio VargasMicrosoft Senior Cloud Consultant

Commented:
If you want to delete a mail sent from xpto@hotmail.com just dont use the date. use the from: parameter. like from:xpto@hotmail.com
Antonio VargasMicrosoft Senior Cloud Consultant

Commented:
I dont think that you can use a date range. what you have to do is to configure the filter with a syntax. the best way to test the syntax is to build the command without the -deletecontent and check the output. test and then when the output is what you want just add the deletecontent
LeoSnr Network Eng

Author

Commented:
i tested it couple of times, but it keeps thinking and doesnt generate an output report.
Antonio VargasMicrosoft Senior Cloud Consultant

Commented:
use a simplier command and check if you get an output. like:

Search-Mailbox -Identity "April Stewart" -SearchQuery 'sent:19/10/2010'
LeoSnr Network Eng

Author

Commented:
it came up with an error :-(

The target mailbox or .pst file path is required.
    + CategoryInfo          : InvalidArgument: (:) [], ArgumentException
    + FullyQualifiedErrorId : 72CC2AE3
Microsoft Senior Cloud Consultant
Commented:
add this to the command:

-TargetMailbox "DiscoveryMailbox"

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