I want to expand a PowerShell Group Object. But only the first Object.
Get-EventLog -Logname system -EntryType "Error" | Group-Object 'InstanceID' | Select-Object Count, Name, @{Name="Message";Expression={$_.Group.Message[0]}} | Format-Table -Wrap
Results in:
Count Name Message
----- ---- -------
161 17 ESIF(8.7.10200.12510) TYPE: ERROR MODULE: DPTF TIME 81546445 ms
This is fine. But if there is only 1 Event Count:
Count Name Message
----- ---- -------
1 8193 V
They got only the first char.
How can i get the complete, first String? Any suggestions?
Thanks.
You could use
Select-Object
to select the first message.The only difference for me in the output of my example vs yours is the entire message is collected for single count entries vs just the first character.