Solved

Exchange 2010 - Powershell

Posted on 2013-10-23
6
596 Views
Last Modified: 2013-10-23
Hi,

I try to delete from some of my users mailbox mails that are older then the 01/01/2000. I'm using:
Search-Mailbox -Identity "USER" -SearchQuery "Received:< 01/01/2010" -DeleteContent -force

It's working, the problem it delete all contacts that added before 01/01/2010 as well.
How can I still delete the mails older than 01/01/2010 but exclude the contacts folder from been deleted?

How to change the SearchQuery.
0
Comment
Question by:ym1
  • 4
  • 2
6 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 39594585
I don’t think Search-Mailbox will allow you to exclude or only include specific folders.. You can specify the the kind of items to search. So if you specify email, then it will search only for email items..

Try..
Search-Mailbox -Identity "USER" -SearchQuery "'kind:email' AND 'Received:< 01/01/2010'" -DeleteContent -force

Open in new window

0
 

Author Comment

by:ym1
ID: 39594631
Subsun thanks it's doing part of the job as not delete the contacts but it not clear tasks and calendar.
0
 
LVL 40

Accepted Solution

by:
Subsun earned 250 total points
ID: 39594750
You can add multipple conditions like

"'kind:email' OR 'kind:meetings' OR 'kind:tasks' AND 'Received:< 01/01/2010'"

Open in new window


Ref : http://msdn.microsoft.com/en-us/library/aa965711(v=vs.85).aspx
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 40

Expert Comment

by:Subsun
ID: 39595089
Just wondering about the reason for B grade!

Please see the EE guidelines on grading..
http://support.experts-exchange.com/customer/portal/articles/481419
0
 

Author Comment

by:ym1
ID: 39595285
just small point the syntax was not accepted, need to be:
Search-Mailbox -Identity "USER" -SearchQuery "(kind:email) AND (Received:< 01/01/2010)" -DeleteContent -force
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39595300
May be, I didn't tried... I cannot connect to my lab now..  If the quotes were not working you can try without quotes.. it should work as well..
Search-Mailbox -Identity "USER" -SearchQuery "kind:email AND Received:< 01/01/2010" 

Open in new window

0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
In this video we show how to create a Distribution Group 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 Recipients >>…
In this video we show how to create an email address policy 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 Mail Flow…

919 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now