How to format ContentFilter parameter for New-MailboxExportRequest

big_daddy0690
big_daddy0690 used Ask the Experts™
on
I need help with the proper formatting to group ContentFilter properties to get the desired output for the export. I'd like emails sent after 3/31/12 that have either of the two participants.

The following returns an empty pst file:

New-MailboxExportRequest -Mailbox "username" -FilePath "\\Server\Share\username.pst" -ContentFilter {((Participants -eq "user1@domain.com") -or (Participants -eq "user2@domain.com")) -and (Sent -gt "03/31/2012")}

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hello, one idea I have is using a -match statement to match mulitple strings in one go, try this instead:
New-MailboxExportRequest -Mailbox "username" -FilePath "\\Server\Share\username.pst" -ContentFilter {(Participants -match "user1@domain.com|user2@domain.com") -and (Sent -gt "03/31/2012")}

Open in new window

Also check your datetime is actually the datetime you think it is. Sometimes servers don't run the same locales and switch the days and months around. In the window just enter this and check it comes back with 31st March:
[datetime]"03/31/2012"

Open in new window

Author

Commented:
I get an error back stating that -match is not a valid operator. I believe ContentFilter has a limited set of operators.
Fair play, how about this then:

New-MailboxExportRequest -Mailbox "username" -FilePath "\\Server\Share\username.pst" -ContentFilter {((Participants -eq "user1@domain.com") -and (Sent -gt "03/31/2012")) -or ((Participants -eq "user2@domain.com") -and (Sent -gt "03/31/2012"))}

Open in new window


Also can you confirm they work individually?

i.e:

New-MailboxExportRequest -Mailbox "username" -FilePath "\\Server\Share\username.pst" -ContentFilter {((Participants -eq "user1@domain.com") -and (Sent -gt "03/31/2012"))}
New-MailboxExportRequest -Mailbox "username" -FilePath "\\Server\Share\username.pst" -ContentFilter {((Participants -eq "user2@domain.com") -and (Sent -gt "03/31/2012"))}

Open in new window


I would keep upping the complexity until it doesn't work then work from that. If my suggestion works then great. If not check they work individually.

If they do then try them together but remove the Sent param and see if that works.

Author

Commented:
I've come to the conclusion that ContentFilter has its issues. I can not get any type of recipient type filter to provide results even when that is the only filter. Date and other filters work as expected.

I ended up just using the date filter to export and then used the mail client to filter the results further.

Thank you for the suggestions.

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