Jump to content

Filter EventLog


Recommended Posts

Hi,

in C# I can set a filter when I read the Event log. Example:

I only want the Errors from the application Event log, the SourceName should be "MyApp", the CategoryString should be "whatever" and TimeGenerated should be >= "some dateTime" (that is possible in C#).

Is there a way to do that in AutoIt, other than read the whole log and filter every single record with "if" statements?

Thanks in advance

dolphins

Link to comment
Share on other sites

  • Moderators

You can query with the built in Windows wevtutil utility and the qe switch to filter events.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

the WMI way - adapt this to your needs:

'?do=embed' frameborder='0' data-embedContent>>

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Thanks everybody for the answers.

@Spider001

Since there is no .NET installed on the Server (and it is not allowed to install it for security reasons), I am not going for this way.

@orbs

I am using WMI in C# to read the Event log from the Client. Unfortunately since Windows Server 2008 you must use the user "Administrator" to use WMI. On Windows Server 2003 it was enough to use a user that is in the Administrator Group. At least this is when you connect with WMI from a Client to a Server. Not sure if you run WMI directly on the Server !?

@JLogan3o13

I didn't know about that tool. I will give it a try! Thanks :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...