Remove-CalendarEvents on Exchange Online throws: "String was not recognized as a valid DateTime!

Copper Contributor

Seems that problem appears only for Remove-CalendarEvents cmdlet when we set its QueryStartDate parameter.
We have tested Set-Mailbox with StartDateForRetentionHold and EndDateForRetentionHold parameters and Set-MailboxAutoReplyConfiguration with -StartTime and -EndTime and these cmdlets worked just fine. For all cmdlets we have specified dates as object of DateTime type but error appears only for Remove-CalendarEvents.
Problem happens on different time formats, we have tested United Kingdom(dd/MM/yyyy) and Unkrainian(dd.MM.yyyy) formats and it seems that problem appears when day part is in the first place. Everything is ok when we using United Sates(M/d/yyyy) format.

 

We tried creating dates in different ways:
$date = Get-Date -Date "27.08.2020"
$date = [System.DateTime]::Parse("27.08.2020")
We even tried to specify the kind of days created, but that didn't change anything.

 

**Full error:**
Error on proxy command 'Remove-CalendarEvents -Identity:'' -CancelOrganizedMeetings:$True
-Confirm:$False -QueryStartDate:'27/08/2020 00:00:00' -QueryWindowInDays:'1825'' to server
VI1PR06MB5152.eurprd06.prod.outlook.com: Server version 15.20.3999.0000, Proxy method PSWS:
Cmdlet error with following error message:
System.Management.Automation.ParentContainsErrorRecordException: Cannot process argument transformation on parameter
'QueryStartDate'. Cannot convert value "27/08/2020 00:00:00" to type "Microsoft.Exchange.ExchangeSystem.ExDateTime". Error:
"String was not recognized as a valid DateTime.".

 

**Environment:**
**PSVersion:** 5.1.17763.1490
**PSEdition:** Desktop
**PSCompatibleVersions:** {1.0, 2.0, 3.0, 4.0...}
**BuildVersion:** 10.0.17763.1490
**CLRVersion:** 4.0.30319.42000
**WSManStackVersion:** 3.0
**PSRemotingProtocolVersion:** 2.3
**SerializationVersion:** 1.1.0.1

 

I've tested this case on another computer and it wasn't reproduced. I don't fully sure that problem is only in version of powershell but I have performed the same actions as on the first computer.
**Environment:**
**PSVersion:** 5.1.17134.407
**PSEdition:** Desktop
**PSCompatibleVersions:** {1.0, 2.0, 3.0, 4.0...}
**BuildVersion:** 10.0.17134.407
**CLRVersion:** 4.0.30319.42000
**WSManStackVersion:** 3.0
**PSRemotingProtocolVersion:** 2.3
**SerializationVersion:** 1.1.0.1

 

0 Replies