Hye all, today I will share with you guys how to simulate error on Event Logs. If you works in an Enterprise level, you most likely have some type of central monitoring system that collect errors from your event logs such as System Center Operation Manager.
To begin this, let’s open Windows PowerShell console and see what cmdlets are available that deal with the event logs;
Step 1: Open the Windows PowerShell console and type “get-command –Name *eventlog”. This command will search all the command contain work “eventlog”. To simulate the error, we need to use Write-EventLog command.
Command: get-command –Name *eventlog
Step 2: To simulate the Error EventLog, please follow below command;
Command: Write-Eventlog –LogName Application –Source “Firdaus” –EntryType Error –EventID 8888 Message “for testing only”
Step 3: Open Event Viewer and verify the Error EventLog
Event Properties details of the message:
As you can see, the source is now populated with “Firdaus”. You can also use this to create an event log specifically for your script or to create a source for event logs other than the Application log.
This post first appeared on Firdasyah Experiences [Microsoft System Infrastructure]. Read the original article.