I am working in VB.NET and trying to automate a driver install process. I am stuck on finding a way (if even possible?) to check the device manager. The driver in question makes it's own section/category (For lack of a better term. Similar to the Batteries, Monitors, Processors, Ports, etc. level in the device manager list). It is proprietary, so if the "Custom Driver" section/category is listed I just want to have my WinForm show/hide some buttons if the driver is already installed.
I have made the reference to System.Management in project resources and added the namespace Imports System.Management
to the top of my code but I cannot find an example that's even close to what I would like to do.
'Pseudo Code:
DIM name as String = "Custom Driver"
DIM DevMangr as New System.Management.Reader()
DIM Category as String = DevMangr.ReadLine()
Do While DevMangr.Peek <> -1
If Category.StartsWith(name)
Button1.Visible = False
Label1.Visible = True
Button2.Visible = True
Label2.Visible = False
End If
Loop
DevMan.Close()
Thanks to help from Jimi in the Comments, I was able to solve my problem. Actual code for anyone interested is below:
Essentially what this does is check Device Manager for "Custom Driver" and if it is there, turn Label1 on, which is a message about the driver being all set.