Hi,
You can use Get-EventLog for this:
Get-EventLog -LogName Application -Newest 10 -ComputerName COMPUTERNAME |
Export-Csv .\events.csv -NoTypeInformation
Get-EventLog is okay, but you may find that you need to start using Get-WinEvent if your needs ever change.
EDIT:
If all you want is the time, source and message, you can use this instead:
Get-EventLog -LogName Application -Newest 10 -ComputerName COMPUTERNAME |
Select TimeGenerated, Source, Message |
Export-Csv .\events.csv -NoTypeInformation
You may want to use TimeWritten instead of TimeGenerated, that's up to you.
Don't retire TechNet! -
(Don't give up yet - 12,830+ strong and growing)