Process Thread Count Query in WMI

T

Thunder$truck

Hi,
I'm trying to use a WMI script in a VB.NET application to query for a
perticular process running and return it's threadcount to the
application.

I was hoping I could simply substitute:
SELECT * FROM Win32_Process WHERE NAME = 'ZTOPTASK'
in the place of the Win32_NetworkAdapterConfiguration and change the
DNSDomain portions to if mo("ThreadCount") > 0 then
ListBox7.Items.Insert(0, "" & mo("ThreadCount"))


Dim query As ManagementObjectSearcher
Dim queryCollection As ManagementObjectCollection
Dim co As ConnectionOptions
Dim oq As System.Management.ObjectQuery
Dim ms As System.Management.ManagementScope
Dim mo As ManagementObject
Dim strComputerName, strQuery As String

strComputerName = ComboBox2.Text

strQuery = "SELECT * FROM Win32_NetworkAdapterConfiguration"

co = New ConnectionOptions()
ms = New System.Management.ManagementScope("\\" +
strComputerName + "\root\cimv2", co)
oq = New System.Management.ObjectQuery(strQuery)
query = New ManagementObjectSearcher(ms, oq)

queryCollection = query.Get()

For Each mo In queryCollection
If mo("DHCPEnabled") = "True" And mo("DNSDomain") <> ""
Then
ListBox7.Items.Insert(0, "" & mo("DNSDomain"))
End If

'If mo("DNSDomain") = "" Then
'Else
' ListBox7.Items.Insert(0, "" & mo("DNSDomain"))
'End If

Next

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top