Link to home
Create AccountLog in
Avatar of Share IT
Share ITFlag for Netherlands

asked on

Search-Mailbox -DeleteContent Exclude Folder(s)

I have a lot of users with a big mailboxes in Exchange 2010 SP1.

I use the following commands to archive the data to pst-files (for some reasons we don't want to use the exchange archive functions):

 
New-MailboxExportRequest -Mailbox "mailname" -FilePath \\ourserverpath\2007.pst -ContentFilter {(Sent -ge '2007-01-01') -and (Sent -le '2007-12-31')} -BadItemLimit 10000 -AcceptLargeDataLoss

Search-Mailbox -identity "mailboxname" -SearchQuery "Sent:> $('2006-12-31') and Sent:< $('2008-01-01')"  -Confirm:$false -Force -TargetMailbox "targetuser" -TargetFolder "SearchAndDeleteLog" -LogLevel Full -DeleteContent

Open in new window


With the second command we delete all the content for that data range. But we have a problem: it removes also the contacts of the user wich are created in that data range. I want to exclude the 'contact' folder. I can't find the solution. Anybody can help me?
ASKER CERTIFIED SOLUTION
Avatar of Akhater
Akhater
Flag of Lebanon image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer