O R G A N I C / F E R T I L I Z E R: writing event log entries with powershell

Feb 5, 2009

writing event log entries with powershell

just some more stuff i picked up hanging out with the #powershell guys.

 

# Writing an event
$EventLog = New-Object System.Diagnostics.EventLog('Application')
$EventLog.MachineName = "."
$EventLog.Source = "WorkstationEngineering"
$EventLog.WriteEntry("Testing Event","Warning", $EventID)

 

# viewing overloads
($myevent.WriteEntry).OverloadDefinitions

 

# Listing enums
[enum]::getvalues([system.diagnostics.eventlogentrytype])