New-MailboxExportRequest Mishandles Dates with Content Filter
So I have been testing the New-MailboxExportRequest cmdlet in Exchange 2010 quite a bit as of late, and have run across some odd behavior in my environment. Basically it has to do with storing dates in a variable, and then using the variable in the script. So for example this works (as in exports only items from the 3rd and 4th of November 2011)... PS> New-MailboxExportRequest -ContentFilter {(Received -gt '11/02/2011'} -and (Received -lt '11/05/2011')} -Mailbox "useralias" -FilePath "\\server\share\file.pst" However if I instead declare the variables first... PS> $begin = '11/02/2011' PS> $end = '11/05/2011' PS> New-MailboxExportRequest -ContentFilter {(Received -gt $begin} -and (Received -lt $begin)} -Mailbox "useralias" -FilePath "\\server\share\file.pst" Then it ends up exporting the users entire mailbox (instead of just received on November 3rd and 4th). When I look at the export request. PS> Get-MailboxExportRequest | Get-MailboxExportRequestStatistics | select * I end up seeing that the ContentFilter is showing (Received -ne $null), where as on the first one shows the same ContentFilter as I had requested. Now I thought maybe it had something to do with the data being a string, instead of DateTime, so I tried converting the strings to DateTime with the following commands, although that did not resolve the issue either. PS> [datetime]::ParseExact($begin,"MM/dd/yyyy",$null) PS> [datetime]::ParseExact($end,"MM/dd/yyyy",$null) Anyone have any thoughts? Is this a known bug, an unknown bug, or perhaps just some sort of stupid typo or misunderstanding about powershell? -mattIf this post is helpful, please mark it as such.
November 13th, 2011 1:22am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics