Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


visual studio eventlog1 query events by date/time or WMI query by date/time

Posted on 2010-09-15
Medium Priority
Last Modified: 2012-05-10
I am using the WMI for the following:
Dim objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & myServer & "\root\cimv2")
            Dim colLoggedEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = '" & Me.cmbEventType.SelectedItem.ToString & "'")

This section below is commented out since I do not know what to use as a filer column
            'and TimeGenerated >='" & Me.dtFrom.ToString & "' and TimeGenerated <='" & Me.dtto.ToString & "'"

This section below is using vb studio 2010 and i do not know how to filter this either for a date/time range.

Me.EventLog1.MachineName = myServer
                'Me.EventLog1.Log = Me.cmbEventType.SelectedItem.ToString
                'myEventLogCount = Me.EventLog1.Entries.Count

                'For m = 0 To myEventLogCount

                '    myDate = Me.EventLog1.Entries.Item(m).TimeGenerated.Month & "/" & Me.EventLog1.Entries.Item(m).TimeGenerated.Day & "/" & Me.EventLog1.Entries.Item(m).TimeGenerated.Year
                '    myTime = Me.EventLog1.Entries.Item(m).TimeGenerated.Hour & ":" & Me.EventLog1.Entries.Item(m).TimeGenerated.Minute & ":" & Me.EventLog1.Entries.Item(m).TimeGenerated.Second
                '    mySource = Me.EventLog1.Entries.Item(m).Source
                '    myCategory = Me.EventLog1.Entries.Item(m).Category
                '    myEvent = Me.EventLog1.Entries.Item(m).EntryType
                '    myUser = Me.EventLog1.Entries.Item(m).UserName

Question by:mphillip85
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 65

Accepted Solution

RobSampson earned 2000 total points
ID: 33687689
Hi, the syntax for the date you need is


It's called UTC format:

This would hopefully help you convert your time to UTC in VB.NET:



Author Closing Comment

ID: 33697431
this is what i needed.
LVL 65

Expert Comment

ID: 33697441
Thanks for the grade.  I'm not that familiar with .NET....would you mind posting the line(s) of code that you used to convert your input box dates to UTC?



Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question