Test Eventlog Eintrag erzeugen

Posted by O.Sommer

Will man, z.B. für Monitoring Tools wie SCOM, GFI MAX oder ähnliche Tools eine Überwachung auf bestimmte Events einführen, so steht man häufiger vor dem Problem wie man diese Eventüberwachung testen kann.
Eine einfache Möglichkeit ist ein Event manuell im LOG zu erzeugen:
Hierzu kann Write-Eventlog in Powershell verwendet werden:

NAME
    Write-EventLog

SYNOPSIS
    Writes an event to an event log.

SYNTAX
    Write-EventLog [-LogName] <string> [-Source] <string> [-EventID] <int> [-Message] <string> [[-EntryType] {Error | W
    arning | Information | SuccessAudit | FailureAudit}] [-Category <Int16>] [-ComputerName <string>] [-RawData <Byte[]
    >] [<CommonParameters>]

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 t
    he event log.

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

Beispiel:

Write-EventLog -EventId 4120 -LogName EASY -Source Portal -Message "TEST" -EntryType Error

http://technet.microsoft.com/de-de/library/hh849847(v=wps.620).aspx