System_Check_Incidents.ps1

function System-CheckIncidents {
             $incidents = Get-EventLog -LogName Security -EntryType Error | Select-Object -Property TimeGenerated, Message
             if ($incidents){
             $incidents | Out-File -FilePath 'C:'
             }
}