Write to event log with PowerShell


Register new source

New-EventLog -LogName 'Application' -Source 'MyApp'

Write to the event log

Write-EventLog -LogName 'Application' -Source 'MyApp' -Message "The PowerShell script has executed successfully" -EventId 1000 -EntryType 'Information'