Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

New events in event viwer

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 05-29-2007   #1 (permalink)
Did
Guest


 

New events in event viwer

Hi to u all,
I try to find way to process new events which arriving to the
application log in event viewer.
there is a script which search all the time for new events (in
powerShell) ?

Thanks
Didi


My System SpecsSystem Spec
Old 05-29-2007   #2 (permalink)
/\/\o\/\/ [MVP]
Guest


 

RE: New events in event viwer

You can do this with Oisin's excelent Eventing library :

PoSH> Add-PSSnapin pseventing
PoSH>
PoSH> $el = new-Object System.Diagnostics.EventLog("Application")
PoSH> $el.EnableRaisingEvents = $true
PoSH>
PoSH> Connect-EventListener el EntryWritten -verbose
VERBOSE: Target is a EventLog
VERBOSE: Now listening for 'EntryWritten' events from $el
PoSH>
PoSH> $el.Source = 'mow'
PoSH> $el.WriteEntry('foo','Information',10)
PoSH>
PoSH> Sleep 1
PoSH>
PoSH> $event = Get-Event
PoSH>
PoSH> $event

Occurred Source Name
Args
-------- ------ ----
----
2007-05-29 4:46:52 PM variable:el
EntryWritten System.Diagnostics.EntryWritten...


PoSH> $event.args.entry

Index Time Type Source EventID Message
----- ---- ---- ------ ------- -------
2533 May 29 16:46 Info mow 10 foo

for another example :

http://thepowershellguy.com/blogs/po...-released.aspx

and you can find this library here :
http://www.codeplex.com/PSEventing

Enjoy,

Greetings /\/\o\/\/
http://thePowerShellGuy.com


"Did" wrote:

> Hi to u all,
> I try to find way to process new events which arriving to the
> application log in event viewer.
> there is a script which search all the time for new events (in
> powerShell) ?
>
> Thanks
> Didi
>
>

My System SpecsSystem Spec
Old 05-29-2007   #3 (permalink)
Marco Shaw
Guest


 

Re: New events in event viwer

Did wrote:
> Hi to u all,
> I try to find way to process new events which arriving to the
> application log in event viewer.
> there is a script which search all the time for new events (in
> powerShell) ?
>
> Thanks
> Didi
>


Are you looking for something like /\/\o\/\/ provided or for something
more like this:
http://www.microsoft.com/technet/scr.../lgevvb17.mspx

Keep in mind the above is written in VBScript, but porting is easy.

Marco
My System SpecsSystem Spec
Old 05-29-2007   #4 (permalink)
/\\/\\o\\/\\/ [MVP]
Guest


 

Re: New events in event viwer

The example Marco gave, can also take advantage of the PSeventing library ,
the example I give here shows also how to convert the VbScript sample to
PowerShell ( the only difference is the Clasname and type of event )

http://thepowershellguy.com/blogs/po...-released.aspx

without the http://www.codeplex.com/PSEventing library you can only wait for
a change

I made also an example on my blog how to use the eventlog in that case (also
using WMI) see :

http://thepowershellguy.com/blogs/po...fic-words.aspx

Greetings Marc

"Marco Shaw" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
news:Ocsh44goHHA.4960@TK2MSFTNGP02.phx.gbl...
> Did wrote:
>> Hi to u all,
>> I try to find way to process new events which arriving to the
>> application log in event viewer.
>> there is a script which search all the time for new events (in
>> powerShell) ?
>>
>> Thanks
>> Didi
>>

>
> Are you looking for something like /\/\o\/\/ provided or for something
> more like this:
> http://www.microsoft.com/technet/scr.../lgevvb17.mspx
>
> Keep in mind the above is written in VBScript, but porting is easy.
>
> Marco


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Log Full of VPCNetS2 Events Victor S. Virtual Server 4 08-15-2008 11:45 AM
Managing Events in Event Viewer Bill T. Vista General 4 01-09-2008 04:04 PM
Event Viewer/Operational Events Sharee31 Vista performance & maintenance 5 03-02-2007 10:03 AM
Import events into an app's event log? Ted Howard Vista General 0 06-15-2006 10:14 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51