Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WMI query - get fields? 1

Status
Not open for further replies.

haddaway

Programmer
Jul 6, 2005
172
SE
I have some problems retrieving field values from a WMI query. For example I would like to know the name of the process that has been started:

Dim query As String = "SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_Process'" '
watcher = New ManagementEventWatcher(query)
Dim handler As New MyHandler(watcher)
AddHandler watcher.EventArrived, AddressOf handler.Arrived

Public Sub Arrived(ByVal sender As Object, ByVal e As EventArrivedEventArgs)
Try
Dim mbo As ManagementBaseObject = DirectCast(e.NewEvent, ManagementBaseObject)

MsgBox(mbo("Name").value)

Catch ex As Exception
MsgBox(ex.ToString)
End Try


Do I have to join tables to do this or what I am I missing?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top