Write Event to Windows Event Log using PowerShell

 

Creating an EventLog entry using PowerShell is shown below:

 

Note: The Event Source needs to be created before writing entries to the Event Log. (See this post for further info: Create Event Source with PowerShell)

 

 

Useful command lines to access different parts of Windows Control Panel

Use these commands (.cpl) to gain fast access to different part of the Windows Control Panel:

Create Event Source with PowerShell

To create a Event Source in PowerShell use this:

Get more info on CreateEventSource method here : http://msdn.microsoft.com/en-us/library/2awhba7a.aspx

 

In PowerShell 2.0 this is even simpler:

 

Enumerate COM classes using WMI

 

Quick and short way of enumerating COM classes is using the WMI class Win32_ClassicComClassSetting.

Example:

 

 

EventLog: Determine Windows startup (Event Log Service)

To determine when Windows was started search for Event ID 6005 in the System Event Log. The entry should look like this: