PowerShell Logo Small

Write-EventLog



This is the built-in help made by Microsoft for the command 'Write-EventLog', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Writes an event to an event log.

SYNTAX


Write-EventLog [-LogName] <String> [-Source] <String> [-EventId] <Int32> [[-EntryType] {Error | Warning | Information | SuccessAudit | FailureAudit}] [-Message] <String>
[-Category [<Int16>]] [-ComputerName [<String>]] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable
[<System.String>]] [-RawData [<Byte[]>]] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Write-EventLog cmdlet writes an event to an event log.


To write an event to an event log, the event log must exist on the computer and the source must be registered for the event log.


The cmdlets that contain the EventLog noun (the EventLog cmdlets) work only on classic event logs. To get events from logs that use the Windows Event Log technology in
Windows Vista and later versions of Windows, use Get-WinEvent.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=293931
Clear-EventLog
Get-EventLog
Limit-EventLog
New-EventLog
Remove-EventLog
Show-EventLog
Write-EventLog

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>write-eventlog -logname Application -source MyApp -eventID 3001 -entrytype Information -message "MyApp added a user-requested feature to the display." -category 1
-rawdata 10,20



This command writes an event from the MyApp source to the Application event log.










-------------------------- EXAMPLE 2 --------------------------

PS C:\>write-eventlog -computername Server01 -logname Application -source MyApp -eventID 3001 -message "MyApp added a user-requested feature to the display."



This command writes an event from the MyApp source to the Application event log on the Server01 remote computer.