Eventlog Error Reporting

How can I display each item in the name column separated by , and keep the count column the same.

I am trying to produce a script that gets the event error log and organize event id by count, under the name column I get the event ID, machine Name, Message. I want the 3 fields to display in there own column to make it easier to read, and keep the count column. Is there a better way of achieving the results?

You’ll have to modify your Select-Object, and instead of just selecting the Name property, create a custom (“calculated”) property that does what you want. I’m unclear what your data looks like as-is, or I’d offer an example, but broadly:

Select -Prop Count,@{n=‘Name’;e={ $_.Name -join “,”}}

Is one example of a calculated column, which assumes the Name property is an array, and turns it into a comma-delimited list.

Before I go any further, Don Jones I watched many of your videos that got me to the point of where I am at. Thanks for everything you have done!

Now, when i replace the select Piece with this code it gives me the same read out. I guess I am not grasping what this does. The name property was built from the group-object command which i used to select the fields (eventID, Machinename, Message) I assume this is an array? Excuse my lack of knowledge as I am still trying to grasp these concepts and syntax.

BTW, 1 last time, Huge fan of your work. You make learning easy for me through your videos, etc…

This is what the output looks like

get-EventLog -ComputerName $env:COMPUTERNAME -LogName System -EntryType error -after ((get-date).date.AddDays(-7)) | Group-Object eventid, MachineName, Message | select count, @{Name=“EventId”;Expression={$.Name.split(‘,’)[0]}}, @{Name=“Computername”;Expression={$.Name.split(‘,’)[1]}}, @{Name=“Data”;Expression={[string]$.Name.split(‘,’)[2…$.Name.split(‘,’).length]}}

A gentleman of Reddit helped me out. Here is the code