Avatar of Wilder1626
Wilder1626
Flag for Canada asked on

VB6 - CMD search from VB6 application

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
Visual Basic Classic

Avatar of undefined
Last Comment
Arana (G.P.)

8/22/2022 - Mon
Arana (G.P.)

so right now it is only searching what areas?
(devices type)
Arana (G.P.)

Also you might want to use Win32_PnPEntity instead of pnpsigneddriver
Wilder1626

ASKER
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.
Your help has saved me hundreds of hours of internet surfing.
fblack61
ASKER CERTIFIED SOLUTION
Arana (G.P.)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.