-2

How can I create a custom event in Windows OS?

I must be able to create a custom event data containing various parameters.

It might be either using command prompt or PowerShell.

Community
  • 1
  • 1

1 Answers1

0

You can always record entries into Application event log using call to one of overloads of method EventLog.WriteEvent. For example this one:

[System.Runtime.InteropServices.ComVisible(false)]
public void WriteEvent (System.Diagnostics.EventInstance instance, byte[] data, params object[] values);

Every .Net Class can be easily automated using Windows PowerShell.

Also there are exist special command for PowerShell - Write-EventLog:

Write-EventLog
     [-LogName] <String>
     [-Source] <String>
     [[-EntryType] <EventLogEntryType>]
     [-Category <Int16>]
     [-EventId] <Int32>
     [-Message] <String>
     [-RawData <Byte[]>]
     [-ComputerName <String>]
     [<CommonParameters>]

Mayby you will found it more useful.

In Python there are exist special logger class NTEventLogHandler which write event to Windows Event Log.

Alexander
  • 1,232
  • 1
  • 15
  • 24