To write to the event log with PowerShell, register an event source once as administrator, then send entries with Write-EventLog:
New-EventLog -LogName Application -Source PSFAQsDemo
Write-EventLog -LogName Application -Source PSFAQsDemo -EventId 1001 -EntryType Information -Message 'Nightly backup finished.'
In this tutorial, I’ll build that logging into a real backup script, step by step, so you can write to event log PowerShell entries that your monitoring tools pick up.
Our example admin is Maria Lopez, who runs IT for a Denver logistics office. Her nightly backup script works, but nobody notices when it fails. Event log entries fix that.
Step 1: Check your PowerShell version and admin rights
Write-EventLog and New-EventLog are Windows PowerShell 5.1 cmdlets. Check what your session gives you first:
Get-Command Write-EventLog, New-EventLog |
Format-Table Name, CommandType, Version -AutoSize
Output:
Name CommandType Version
---- ----------- -------
Write-EventLog Function 1.0
New-EventLog Function 1.0

The output above is from PowerShell 7. Windows PowerShell 5.1 lists them as Cmdlet 3.1.0.0. If you’re not sure which one you’re in, here’s how to check your PowerShell version.
Registering a source needs a member of the local Administrators group in a Run as administrator window. This check prints True when you have that:
$id = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = [Security.Principal.WindowsPrincipal]$id
$principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
Output:
False
My test account isn’t an administrator, so the source steps below are shown as code. Every other example ran for real in both versions.
Step 2: Register an event source with New-EventLog
An event source is the name your entries appear under, usually your script or app name. Run this once per computer, as administrator:
New-EventLog -LogName Application -Source PSFAQsDemo
The source is stored as a registry key under the Application log. Without admin rights, both versions refuse it:
try {
New-EventLog -LogName Application -Source PSFAQsDemo -ErrorAction Stop
}
catch { "Failed. $($_.Exception.Message)" }
Output:
Failed. Access is denied. Try running the command again in a session that has been opened with elevated user rights (that is, Run as Administrator).
Checking whether a source exists also needs admin rights, because Windows searches every log, including Security:
try { [System.Diagnostics.EventLog]::SourceExists('PSFAQsDemo') }
catch { "Failed. $($_.Exception.InnerException.Message)" }
Output:
Failed. The source PSFAQsDemo was not found on computer ., but some or all event logs could not be searched. Inaccessible logs: Security.
The output above is from PowerShell 7, which names the source. Windows PowerShell 5.1 only says “The source was not found”.
Step 3: Write an event with Write-EventLog
Once the source exists, Maria’s script passes the parameters as a hashtable with @ (splatting). On a PC without admin rights, I used WSH, a source Windows already registers. Its event ID 0 shows your text as-is:
$event = @{
LogName = 'Application'
Source = 'WSH'
EventId = 0
EntryType = 'Warning'
Message = 'Denver backup finished late: 1,284 files in 47 minutes.'
}
Write-EventLog @event
Get-WinEvent -LogName Application -MaxEvents 1 |
Form