I currently have the code below:
Get-EventLog -LogName Application
| Where-Object EventID -EQ 1033
| Select-Object EventID, Message
So my question is how can I just show the first 10 characters of the Message?
I currently have the code below:
Get-EventLog -LogName Application
| Where-Object EventID -EQ 1033
| Select-Object EventID, Message
So my question is how can I just show the first 10 characters of the Message?
Use the substring method on your message property.
Get-EventLog -LogName Application | Select-Object EventID, @{Label='Message';Expression={$_.Message.Substring(0,10)}}
Just as a follow up:
Get-EventLog -LogName Application
| Where-Object EventID -EQ 1033
| Select-Object EventID, @{l="Message";e={$_.message.substring(0,10)}}