New-MailboxSearch start and end date errors

At first I thought I was doing something wrong, but now I'm pretty certain it's a problem with Exchange PowerShell.

Let's say I want to do a discovery over a single date (yesterday).  If I submit the search from ECP, I put in start and end dates of 4/10/2014 and it'll do as expected, which is to search from 4/10/2014 00:00:00 to 4/10/2014 23:59:59.

However if I do the same thing through PS, with the exact same criteria, it'll do a search from 4/9/2014 18:00:00 to 4/9/2014 18:00:59.  Below is the output of the PowerShell session clearly showing this discrepancy (sorry for the crude redacting and markup, but Windows Snipping Tool really sucks).

We are running Exchange 2010 SP3 with no rollups.

April 11th, 2014 2:18pm

Please copy the text and not the picture.

Try -StartDate "04/10/2014 00:00:00 AM" -EndDate "04/10/2014 12:59:59 PM".

If you want to report this as a bug, please open a ticket with Microsoft Su

Free Windows Admin Tool Kit Click here and download it now
April 13th, 2014 4:30am

Hi Todd,

I have tested in my lab, both "04/01/2014" and "04/01/2014 00:00:00 AM". Pics as below:

1. StartDate: 04/01/2014

2. StartDate: 04/01/2014 00:00:00 AM

The result just as yours.

I found nothing related to it on the public resource.

Did this command return the right result?

 

Thanks

April 14th, 2014 8:36am

Hi Todd,

Any update?

 

Thanks

Mavis

Free Windows Admin Tool Kit Click here and download it now
April 16th, 2014 1:04am

I asked you the first time to post the text, not the picture.
April 16th, 2014 5:05am

Interesting that when you specify both starting and ending TIMES, you get a 13 hour search window instead of the 1 minute search window.  I also find it mildly interesting that yours is searching starting at 2:00AM with the correct date, but when I do it, mine starts at 6:00PM the day before the starting date I specified.  Out of curiosity, what time zone are you in?  I'm wondering if it has something to do with the relationship with GMT.

I've done nothing beyond asking the question here, but I'm glad to see it's not just me.  Does yours work as expected if you do the same thing in ECP?

Free Windows Admin Tool Kit Click here and download it now
April 16th, 2014 2:31pm

...and I didn't post any more pictures...
April 16th, 2014 2:36pm

I just tried it a couple of different ways.

If I specify -StartTime "04/10/2014 00:00:00" -EndTime "04/10/2014 23:59:59" or if I specify -StartTime "04/10/2014 00:00:00 AM" -EndTime "04/10/2014 11:59:59 PM", I get the same result:

StartDate                : 4/9/2014 6:00:00 PM
EndDate                  : 4/10/2014 5:59:59 PM

So this way I'm at least getting a 24-hour search period, but it's the WRONG 24-hour search period.  For the record, my workstation, the Exchange server I'm connected to, and my mailbox are all in MST which is GMT -7:00, so this doesn't even work as a time zone offset from GMT.

Free Windows Admin Tool Kit Click here and download it now
April 16th, 2014 2:47pm

Sorry, Todd, I mixed you up with Mavis's post.  I apologize.
April 16th, 2014 11:53pm

Is it converting the times to GMT?  Or are the time zones different between where you're running the command and the server on which it is being run?
Free Windows Admin Tool Kit Click here and download it now
April 16th, 2014 11:54pm

Does the same thing happen if you use System.DateTime?

New-MailboxSearch -StartDate [System.DateTime]::Now.AddHours(-24) -EndDate [System.DateTime]::Now

April 17th, 2014 5:17am

Hi,

@Ed

Sorry for the inconvenience. I got my TimeZone information and change pic to text, result as below:

[PS] C:\>get-MailboxRegionalConfiguration -identity test1 | FL

RunspaceId                                             : **My GUID**

DateFormat                                             : M/d/yyyy

Language                                                : en-US

DefaultFolderNameMatchingUserLanguage : False

TimeFormat                                             : h:mm  tt

TimeZone                                                : W.  Europe Standard Time

Identity                                                   :

IsValid                                                    : True

 

@Todd

The language that you select will determine the date and time settings in the Date and Time Formats section.

More details in the following blog:

Where is the time zone property stored in exchange 2010

http://blogs.technet.com/b/fun_with_powershell/archive/2013/04/30/where-is-the-time-zone-property-stored-in-exchange-2010.aspx

 

Hope it is helpful

 

Thanks

Mavis

Free Windows Admin Tool Kit Click here and download it now
April 17th, 2014 6:45am

Hi Todd,

Is there any new information to share?

 

Thanks

Mavis

April 20th, 2014 7:58am

Was this ever resolved? I'm having exactly the same issue ..... Exchange 2010 SP2 RU8
Free Windows Admin Tool Kit Click here and download it now
August 12th, 2015 11:52am

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

Other recent topics Other recent topics