Skip to content

Bug: Date format handling issue in Search-UnifiedAuditLog for non-US region settings #285

@ITNgithub

Description

@ITNgithub

Your Question

Getting following error. Is this a bug or do I enter the date wrong?
I am on a systm with Windows 10 22H2
$PSVersionTable.PSVersion
Major Minor Build Revision


5 1 19041 5486

I am starting Hawk with:
Start-HawkTenantInvestigation -StartDate '04/13/2025' -EndDate '04/28/2025' -FilePath 'C:\hawk'

The script runs through, but I get the following error about 5 times:

[2025-04-28 11:41:43Z] - [ACTION] - Running Unified Audit Log Search Write-ErrorMessage : Cannot process argument transformation on parameter 'EndDate'. Cannot convert value "04/28/2025" to type "Microsoft.Exchange.ExchangeSystem.ExDateTime". Error: "String '04/28/2025' was not recognized as a valid DateTime." In C:\Users\REDACTED\AppData\Local\Temp\tmpEXO_4n2p3r50.eqc\tmpEXO_4n2p3r50.eqc.psm1:1189 Zeichen:13

  •         Write-ErrorMessage $ErrorObject
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Search-UnifiedAuditLog], ParameterTransformationException
    • FullyQualifiedErrorId : [Server=GV0P278MB0115,RequestId=ddf22520-04b0-ab95-6e9a-7dfe0ba26288,TimeStamp=Mon, 28 A
      pr 2025 11:42:10 GMT],Write-ErrorMessage

[2025-04-28 11:41:43Z] - [INFO] - Unified Audit log returned no results.

I tried several ways to enter the date string. Either I have the error above if using US date string format, or the program does not start because I formated the date string wrongly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions