PowerShell and EventLogs

So I have been “play” with PowerShell again today, and I have trying to work out how to write an Event to the Eventlog.

Richard gave me some code to do it with vbs, but I found this while surfing (it has taken an age to find!) http://winpowershell.blogspot.com/2006_07_01_archive.html

Anyway, not I have found it the world is my oyster!  So my latest script is for BlackBerry.  It runs BBSrptest and parses the result.  If it fails it will generate an Error in the Application Eventlog and send an email about the failure.  If it okay, it just generates an Information event.

Code is attached, but here is the eventlog bit.  It is surprising how easy it is to use!

##########################################################################################
#Set variable to log stuff to the application event log
#
#Valid values for [System.Diagnostics.EventLogEntryType]
#Error; Warning; Information; SuccessAudit; FailureAudit
##########################################################################################
$evt=new-object System.Diagnostics.EventLog(“Application”)
$evt.Source=”My BlackBerrry”
$infoevent=[System.Diagnostics.EventLogEntryType]::Information

$evt.WriteEntry($strOutput,$infoevent,1)

Weird Picture

Went outside today for a bit of fresh air and took this really bizarre picture

Image034

It looked a bit like a rain cloud, not a fire.

Well that was until Essa text me to tell me that is actually was a fire.  Check this out

http://news.bbc.co.uk/1/hi/england/london/7090725.stm