CmdID

CmdID / PowerShell / Cmdlets / New

New-EventLog

Creates a new event log and a new event source on a local or remote computer. PowerShell reference

From the PowerShell reference 6 parameters

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Creates a new event log and a new event source on a local or remote computer. This cmdlet creates a new classic event log on a local or remote computer. It can also register an event source that writes to the new log or to an existing log. The cmdlets that contain the EventLog noun (the Event log 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.

New-EventLog [-LogName] <string> [-Source] <string[]> [[-ComputerName] <string[]>] [-CategoryResourceFile <string>] [-MessageResourceFile <string>] [-ParameterResourceFile <string>] [<CommonParameters>]

Example 1 - create a new event log

New-EventLog -Source TestApp -LogName TestLog -MessageResourceFile C:\Test\TestApp.dllIdentify

Example 2 - add a new event source to an existing log

$file = "C:\Program Files\TestApps\NewTestApp.dll" New-EventLog -ComputerName Server01 -Source NewTestApp -LogName Application -MessageResourceFile $file -CategoryResourceFile $fileIdentify

Its page in the reference: New-EventLog.

Parameters

6 in the PowerShell reference
-CategoryResourceFileSpecifies the path to the file that contains category strings for the source events. This file is also known as the Category Message File. The file must be present on the computer on which the event log is being created. This parameter does not create or move files.
-ComputerNameCreates the new event logs on the specified computers. The default is the local computer. The NetBIOS name, IP address, or fully qualified domain name of a remote computer. To specify the local computer, type the computer name, a dot (.), or localhost. This parameter does not rely on PowerShell remoting. You can use the ComputerName parameter of Get-EventLog even if your computer is not configured to run remote commands.
-LogNameSpecifies the name of the event log. If the log does not exist, New-EventLog creates the log and uses this value for the Log and LogDisplayName properties of the new event log. If the log exists, New-EventLog registers a new source for the event log.
-MessageResourceFileSpecifies the path to the file that contains message formatting strings for the source events. This file is also known as the Event Message File. The file must be present on the computer on which the event log is being created. This parameter does not create or move files.
-ParameterResourceFileSpecifies the path to the file that contains strings used for parameter substitutions in event descriptions. This file is also known as the Parameter Message File. The file must be present on the computer on which the event log is being created. This parameter does not create or move files.
-SourceSpecifies the names of the event log sources, such as application programs that write to the event log. This parameter is required.