We help IT Professionals succeed at work.

VB6 - CMD search from VB6 application

Wilder1626
Wilder1626 asked
on
Hi

I have below code in my VB6 application where it search for : SELECT * FROM Win32_PnPSignedDriver where (FriendlyName like '% ANT %')

It works but not 100% doing what i want him to do.

 strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PnPSignedDriver where (FriendlyName like '% ANT %')", , 48)
    'Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PnPSignedDriver", , 48)
    For Each objItem In colItems
        Text = "DeviceID: " & objItem.DeviceID
     Text = Text & vbCrLf & "CompatID: " & objItem.CompatID
Text = Text & vbCrLf & "Description: " & objItem.Description
Text = Text & vbCrLf & "DeviceClass: " & objItem.DeviceClass
Text = Text & vbCrLf & "DeviceID: " & objItem.DeviceID
Text = Text & vbCrLf & "DeviceName: " & objItem.DeviceName
Text = Text & vbCrLf & "DevLoader: " & objItem.DevLoader
Text = Text & vbCrLf & "DriverDate: " & objItem.DriverDate
Text = Text & vbCrLf & "DriverName: " & objItem.DriverName
Text = Text & vbCrLf & "DriverVersion: " & objItem.DriverVersion
Text = Text & vbCrLf & "FriendlyName: " & objItem.FriendlyName
Text = Text & vbCrLf & "HardWareID: " & objItem.HardWareID
Text = Text & vbCrLf & "InfName: " & objItem.InfName
Text = Text & vbCrLf & "InstallDate: " & objItem.InstallDate
Text = Text & vbCrLf & "IsSigned: " & objItem.IsSigned
Text = Text & vbCrLf & "Location: " & objItem.Location
Text = Text & vbCrLf & "Manufacturer: " & objItem.Manufacturer
Text = Text & vbCrLf & "Name: " & objItem.Name
Text = Text & vbCrLf & "PDO: " & objItem.PDO
Text = Text & vbCrLf & "DriverProviderName: " & objItem.DriverProviderName
Text = Text & vbCrLf & "Signer: " & objItem.Signer
Text = Text & vbCrLf & "Started: " & objItem.Started
Text = Text & vbCrLf & "StartMode: " & objItem.StartMode
Text = Text & vbCrLf & "SystemName: " & objItem.SystemName
     
    Next
    

Open in new window


I would like the query to search anywhere in the Device Manager areas:
Device Manager
How can i do that?

Thanks again for your hep
Comment
Watch Question

CERTIFIED EXPERT

Commented:
so right now it is only searching what areas?
(devices type)
CERTIFIED EXPERT

Commented:
Also you might want to use Win32_PnPEntity instead of pnpsigneddriver
CERTIFIED EXPERT

Author

Commented:
right now, i'm able to see the device that has "ANT" in the section "Universal Serial Bus Controllers".
But sometime, as an example, a new area called: "libusb-win32 devices" can also have a device that has "ANT". That one never shows up in my query.
CERTIFIED EXPERT
Commented:
this is probably because it is not a signed driver, or it is not installed properly or not currently present
try SELECT * FROM Win32_PnPEntity instead