Windows Eventviewer Log to Text File

<span style=“color: #2a2a2a; font-family: ‘Segoe UI’, ‘Lucida Grande’, Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 17px; background-color: #ffffff;”>In Eventviewer -> Application and Services -> Microsoft -> Windows -> Backup -> Operational there are various events, In case Event ID 4 or 5 occurs need to send all the contents in details tab to a text file using powershell.</span>

The basics of the information you are after i think will be covered by

Get-WinEvent Microsoft-Windows-Backup | where {$ -eq 4 -or $ -eq 5} | select -Property * | Out-File events.txt

That’s the very basics of the command. There are plenty of other parameters that can be set depending on what your deeper requirements are.