Cannot pass a date variable into new-mailboxexportrequest contentfilter

  • Thread starter garry_h
  • Start date Views 1,721
Not open for further replies.


I used to use export-mailbox every night. Now I use new-exportmailboxrequest. Fine on one level however I am unable to pass a date variable into the contentfilter option.

No matter what I do, or how I format the string, it will not evaluate the variable.

Here is roughly what I am trying to achieve


new-exportmailboxrequest -mailbox tommyt -filepath \\server\share\file.pst -contentfilter { send -gt $date }

This exports the entire mail file as opposed to the last 2 weeks

from ( get-mailboxexportrequest | get-mailboxexportrequeststatistics | fl ) I get

ContentFilter : Sent -ne $null

this is not a datetime format issue as

new-exportmailboxrequest -mailbox tommyt -filepath \\server\share\file.pst -contentfilter { send -gt '02/11/2010' }

works but

$date='02/11/2010' followed by

new-exportmailboxrequest -mailbox tommyt -filepath \\server\share\file.pst -contentfilter { send -gt $date }

does not.

Any help would be greatly appreciated

Novak Wu

From your description, I understand that the entire mailbox file is exported after typing the following command: new-exportmailboxrequest -mailbox tommyt -filepath \\server\share\file.pst -contentfilter { send -gt $date }. If I misunderstood, please let me know.

Based on my research, there is only new-mailboxexportrequest command instead of new-exportmailboxrequest. Please assure the command is typed correctly. For more information about the command, please refer to the following article:


Novak Wu
Not open for further replies.