PowerShell Write-EventLog Cmdlet

PowerShell Write-EventLog Cmdlet

PowerShell Write-EventLog Cmdlet

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed New-EventLog cmdlet in PowerShell.


In this blog post, we will discuss Write-EventLog cmdlet in PowerShell. You can use Write-EventLog cmdlet to write new events to a windows event log. You need to have administrative access in order to write an event to an event log. In order to write to the event log, the event log must exist with a proper source registered. You can use Write-EventLog cmdlet to write events into a local or remote computer event log.

Write-EventLog Cmdlet Syntax:

Write-EventLog Cmdlet Argument List:

  • Category: Specifies a task category for the event. Enter an integer that is associated with the strings in the category message file for the event log.
  • ComputerName: Specifies a remote computer. The default is the local computer.
  • EntryType: Specifies the entry type of the event. The acceptable values for this parameter are: Error, Warning, Information, SuccessAudit, and FailureAudit. The default value is Information.
  • EventId: Specifies the event identifier. This parameter is required. The maximum value for the EventId parameter is 65535.
  • LogName: Specifies the name of the log to which the event is written. Enter the log name. The log name is the value of the Log property, not the LogDisplayName. This parameter is required.
  • Message: Specifies the event message. This parameter is required.
  • RawData: Specifies the binary data that is associated with the event, in bytes.
  • Source: Specifies the event source, which is typically the name of the application that is writing the event to the log.

PowerShell Write-EventLog Cmdlet:

Hope you have enjoyed this article. In the next blog post, we will discuss Limit-EventLog CmdLet in PowerShell.

To Set more details on PowerShell, kindly follow below official documentation



Leave a Reply

Close Menu