It is currently March 29th, 2024, 12:27 pm

[FEATURE IDEA] Event Viewer Plugin

Report bugs with the Rainmeter application and suggest features.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

[FEATURE IDEA] Event Viewer Plugin

Post by Yincognito »

I recently read a post about monitoring the Event Viewer for various events - I even discovered an alternative way to do it - and I was wondering if the Rainmeter team or a plugin developer thought about making a plugin to monitor the Event Viewer log at standard (or not) update rates, similar to how other plugins / measures work.

This could have the potential of being useful in debugging various errors within the system, for example, since a skin based on such a plugin could provide a near immediate notification to the user as soon as such an error / event is happening, as opposed to only discovering the error much later without remembering exactly what happened or what led to it. As far as I could tell, there doesn't seem to be any counter in PerfMon.msc to provide such a thing (apart from the usual "how many stuff per session" kind of things), and coding it in C++/C# shouldn't be too difficult (I suppose), so why not?
Profiles: Rainmeter Profile β—‡ DeviantArt Profile β—† Suites: MYiniMeter β—† Skins: Earth
User avatar
nek
Posts: 105
Joined: November 3rd, 2019, 12:00 am

Re: [FEATURE IDEA] Event Viewer Plugin

Post by nek »

How about a trigger On an event of Task Scheduler? taskschd.msc

An example task for monitoring a event log:

Code: Select all

**Trigger**

       Trigger: On an event
           Log: Application
        Source: EventCreate
      Event ID: 100

**Action**

        Action: Start a program
Program/script: C:\Apps\misc\notifu.exe
 Add arguments: /t error /d 5000 /p "Title" /m "Message"
      Start in: C:\Apps\misc
Testing (command prompt - run as administrator):

Code: Select all

eventcreate.exe /t ERROR /id 100 /l application /d "Create event in application log"

πŸ“˜ eventcreate.exe | https://learn.microsoft.com/windows-server/administration/windows-commands/eventcreate
> notifu.exe | https://github.com/ixe013/notifu
> Notifu is a tool that displays a yellow pop-up balloon in the system notification area
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [FEATURE IDEA] Event Viewer Plugin

Post by Yincognito »

nek wrote: ↑May 13th, 2023, 4:46 pm How about a trigger On an event of Task Scheduler? taskschd.msc

An example task for monitoring a event log:

Code: Select all

**Trigger**

       Trigger: On an event
           Log: Application
        Source: EventCreate
      Event ID: 100

**Action**

        Action: Start a program
Program/script: C:\Apps\misc\notifu.exe
 Add arguments: /t error /d 5000 /p "Title" /m "Message"
      Start in: C:\Apps\misc
Testing (command prompt - run as administrator):

Code: Select all

eventcreate.exe /t ERROR /id 100 /l application /d "Create event in application log"

πŸ“˜ eventcreate.exe | https://learn.microsoft.com/windows-server/administration/windows-commands/eventcreate
> notifu.exe | https://github.com/ixe013/notifu
> Notifu is a tool that displays a yellow pop-up balloon in the system notification area
Thanks for answering, but if I'm not mistaken, this involves manually adding the task to the Task Sheduler and running another application (i.e. notifu), not to mention running things as an administrator. What I'm looking for is a way to monitor events in a Rainmeter skin, without any 3rd party application (as in not from Rainmeter or Windows), as the logged on user. I know I can add tasks to the Task Scheduler, but the idea was to integrate it with Rainmeter, in a way that is configurable as a skin.

That being said, I already can do this in PowerShell (both the testing and the monitoring) without having to run it as an administrator...

Test:

Code: Select all

Write-EventLog -LogName "Application" -Source "WSH" -EventID 0 -EntryType Information -Message "Event written to an event log using a script."
Monitor:

Code: Select all

While ($True) {Try {Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='WSH'; ID='0'; StartTime=(Get-Date).AddMilliseconds(-1000)} -MaxEvents 1 -ErrorAction Stop} catch {}; Start-Sleep -Milliseconds 1000;}
...but while this works in PowerShell, the monitoring command doesn't seem to produce STDOUT results that can be captured by a RunCommand measure, because of the loop. Once I solve this, it will work, but it would have been nice to do this from a Rainmeter plugin, without having to trial and error script variants.

P.S. The CScript method I referrred to in the 2nd earlier link is way faster than the PS one and would be the preferred one, but it requires running it as an administrator and according to Brian is slightly unreliable for the future.
Profiles: Rainmeter Profile β—‡ DeviantArt Profile β—† Suites: MYiniMeter β—† Skins: Earth
User avatar
benseverina
Posts: 2
Joined: February 21st, 2022, 3:34 pm

Re: [FEATURE IDEA] Event Viewer Plugin

Post by benseverina »

Yincognito wrote: ↑May 13th, 2023, 5:34 pm P.S. The CScript method I referred to in the 2nd earlier link is way faster than the PS one and would be the preferred one, but it requires running it as an administrator and according to Brian is slightly unreliable for the future.
Resurrecting this thread, because I'm looking for this exact functionality. Were you able to make any headway?
Just a simple Skin with a console log being updated by the Administrative Events view from Event Viewer would be sweet. 8-)
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [FEATURE IDEA] Event Viewer Plugin

Post by Yincognito »

benseverina wrote: ↑February 9th, 2024, 6:25 pm Resurrecting this thread, because I'm looking for this exact functionality. Were you able to make any headway?
Just a simple Skin with a console log being updated by the Administrative Events view from Event Viewer would be sweet. 8-)
I was - sort of, anyway - but didn't pursue this further for the time being, and it's been a while since I wrote these so things are not fresh in my mind at this time. The best I could come up with when I posted this was a synthesis of various ways to do it, each with a drawback that doesn't normally allow a feasible "real-time" monitoring. You can check it here (see the comments and the description for details):
https://forum.rainmeter.net/viewtopic.php?t=42354&start=10#p214995
That's about the only thing I've done in this direction since then (others have tried similar things as well, as you can see in that thread). It's far from perfect, but at least can give you some ideas or offer a basic platfrom on which you can adjust. Other possible avenues might involve some AutoIt / AutoHotKey script trying to get such infos (if it can, of course) and sending them regularly to the Rainmeter skin (the latter part can be done like here). So, long story short, I'm not yet at a point where I tackle this with all guns blazing, so to speak, and I don't know if I'll be. In any case, IF I'll ever find feasible ways to do this and other things like monitoring the nework connections of processes in the future, they will be present in my skin suite. There's no deadline for that though.
Profiles: Rainmeter Profile β—‡ DeviantArt Profile β—† Suites: MYiniMeter β—† Skins: Earth
User avatar
benseverina
Posts: 2
Joined: February 21st, 2022, 3:34 pm

Re: [FEATURE IDEA] Event Viewer Plugin

Post by benseverina »

Thanks for your development, so far.

I also use Autohotkey, so it was in the back of my mind for getting this done. If I put something working together, I'll bump this thread again. Cheers
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [FEATURE IDEA] Event Viewer Plugin

Post by Yincognito »

benseverina wrote: ↑February 9th, 2024, 9:38 pm Thanks for your development, so far.

I also use Autohotkey, so it was in the back of my mind for getting this done. If I put something working together, I'll bump this thread again. Cheers
Sure thing - any idea is welcomed! :thumbup:
Profiles: Rainmeter Profile β—‡ DeviantArt Profile β—† Suites: MYiniMeter β—† Skins: Earth