I'm currently trying to detect which drivers appear as "not working" in visual basic.
This unknown device is a good example of what I'm trying to grab (notice how it has the flag DN_HAS_PROBLEM).
I've tried using searches such as:
Dim searcher As New ManagementObjectSearcher( "root\CIMV2", "SELECT * FROM Win32_SystemDriver")
And running a loop in the searcher.Get() through this documentation
However, none of these seem to return what I am looking for.
Would anyone happen to know how I can get the DN_ statuses within Visual Basic?
Thanks!
The Win32_SystemDriver class documentation lists these Status
properties:
OK Error Degraded Unknown Pred Fail Starting Stopping Service Stressed NonRecover No Contact Lost Comm
...whereas DN_HAS_PROBLEM
comes from the CM_Get_DevNode_Status function, or perhaps also from other system calls.
There may not be a way to get that specific code from the API you're using, but perhaps the existing Status
properties will suffice for your needs if you don't need to know more specific failure reasons.
If you do need to know that specific status, you'll have to call other APIs, like the one I called out.