Solved

WMI - Getting access to the Event Details?

Posted on 2011-03-07
13
662 Views
Last Modified: 2013-12-04
New to WMI.  Have googled a while today, but no luck.

I am generating an error with MySQL (see screenshot attached).

I can get access to a lot of the event info using:
Select * from Win32_NTLogEvent where Type ='Error' and SourceName = 'MySQL'

But I can't seem to get my hands on what I really care about, which is shown in the log viewer in the "box" in the General tag.

I want to get that message "Plugin 'InnoDB' registration as a STORAGE ENGINE failed."

How can I using a WMI query?
0
Comment
Question by:trippy1976
[X]
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
  • 6
  • 5
  • 2
13 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 35068603
0
 
LVL 4

Author Comment

by:trippy1976
ID: 35069484
I forgot to attach the screenshot of the event log viewer.  Also attaching the saved results of my WMI query.  

No, it's sadly not in the Message field... that would be trivial.  I think this is more involved.

Screenshot of the event viewerresult.htm
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35070496
Did you look at the other properties for the Win32_NTLogEvent?

Win32_NTLogEvent Class
http://msdn.microsoft.com/en-us/library/aa394226(v=vs.85).aspx

Is that information in the Data property?
0
Technology Partners: 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!

 
LVL 4

Author Comment

by:trippy1976
ID: 35070758
Yes.  The data is in "InsertionStrings"

I need the information from that object in a WQL query.  

The html doc I attached shows all the properties and their resulting values.  If it were avaialble in a top-level property I wouldn't be posting here :)  Thanks for the help, but I fear the answer to this is "it can't be done"
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35070970
InsertionStrings is a string array, so you should be able to get that information from the Win32_NTLogEvent object.
0
 
LVL 26

Assisted Solution

by:EDDYKT
EDDYKT earned 250 total points
ID: 35071000
don't think it supports on WMI, you may want to use API instead
0
 
LVL 4

Author Comment

by:trippy1976
ID: 35071063
@TheLearnedOne - you can, if you are scripting.  If you are simply doing a WQL query I am not sure if it's possible.

I googled forever, then I turned here.  What I really need is the WMI query that will get the pieces of InsertionString info.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 35071093
Can you show me what you are working with, please?
0
 
LVL 4

Author Closing Comment

by:trippy1976
ID: 35166037
As suspected, you can't query directly to the elements in something like Insertion Strings.  I had to write a VB script to do the query, get the results, and grab that deeper data.  Appears to be the only way to do this.  Thanks everyone.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35169525
Did you come up with the VB script?
0
 
LVL 4

Author Comment

by:trippy1976
ID: 35169798
Yes.  I found the JoinStringsArray function somewhere on google.
strComputer = "."
Set objWMIService = GetObject _
    ( "winmgmts:\\" & strComputer & "\root\cimv2")
	
Set colItems = objWMIService.ExecQuery _
    ("Select * from Win32_NTLogEvent where Type ='Error' and Logfile ='Application' and SourceName='MySQL'")


For Each objItem in colItems     
	strLogString = objItem.TimeGenerated & "," & JoinStringsArray(objItem.InsertionStrings)
Next



Function JoinStringsArray(ByRef aArray)
    If VarType(aArray) = vbNull Then
        JoinStringsArray = ""
        Exit Function
    Else
        JoinStringsArray = Join(aArray)
        JoinStringsArray = Replace(JoinStringsArray, "(NULL)", "")
    End If
End Function

Open in new window

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35171392
You don't need VBScript to do what you have shown.  I don't see anything that it overly complicated, and not achievable with VB.NET/C#.
0
 
LVL 4

Author Comment

by:trippy1976
ID: 35171464
I'm certain you can do it a number of ways.  I really can't go into the specifics of why I needed a VBScript in this case, but it was my choice for workaround.

There was an existing component that could do direct WMI queries, but since you can't get at the info I need via WMI directly I had to go this route.

0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

734 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