The new-mailboxexportrequest commandlet will only accept dates in US formats. Roland Paix has made this post about the issue. The conclusion is switch your culture to EN-US before loading powershell. Sooo frustrating! But hey, something has to be the default datetime and Microsoft is an American company. No point getting emotional, let's just fix it.
Here's a neat trick you can use to set the Culture of the "Current Thread" you are running.
[System.Reflection.Assembly]::LoadWithPartialName("System.Threading")
[System.Reflection.Assembly]::LoadWithPartialName("System.Globalization") [System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::CreateSpecificCulture("en-us") Add-PSSnapin *exchange* $start = (get-date).adddays(-28) $end = (get-date).adddays(-14) $filter = "(Received -gt '"+$start+"') -and (Received -lt '"+$end+"')" new-Mailboxexportrequest -mailbox SOMEMAILBOX -ContentFilter $filter -filepath C:\SOME.pst |
This should trick new-mailboxexportrequest into believing that your dates are in the "correct" format!