Skip to content

Write-WinEvent gets "System.Collections.Generic.List`1[System.String]" in Event Message #48

Open

Description

@endoleg

When i use Write-WinEvent i get "System.Collections.Generic.List`1[System.String]" in Event Message 8and not my message.

To Reproduce
Steps to reproduce the behavior:
$EventData = [ordered]@{Program = 'MyProgram';ThisEvent = 'This is an event I want to track'; SomethingElse = 'I like the C64'}
Write-WinEvent -LogName "Application" -Provider Userinfo -EventId 999 -EventType Information -EventData $EventData

Expected behavior
{
"Program": "MyProgram",
"ThisEvent": "This is an event I want to track",
"SomethingElse": "I like the C64"
}

Screenshots
If applicable, add screenshots to help explain your problem.
image

PowerShell Environment (please complete the following information):

  • OS: [Windows 10]
  • Version [1909]

Additional context
function Write-WinEvent from
https://gist.githubusercontent.com/thedavecarroll/765547120aa1fa801919040f4d5d2046/raw/2def9b386a8eae88bc26726b7d8770c4c1f8452f/EventData.psm1
works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions