Originally Posted By: Shonky
MSFT_NetAdapter is Windows 8/Server 2012 and above only. Is that your problem?


Yep. Damn. I need to be able to reliably detect this on Windows 7 too. frown

Quote:
BTW: to lie = to intentionally make a false statement


Seems real fucking deliberate to me. I'm really mad at whoever wrote that class right now. From a programmer's point of view, it really is lying. You design the code to a specification, and the docs state the spec. The docs specifically say the spec is "Enable" or "Disable", and yet the underlying code is deliberately reporting something entirely different from the spec.

I'm pretty sure it's because someone else needed that class to report the connected state instead of the enabled state for some other thing somewhere else in Windows. So instead of adding or making use of a different field/parameter, they went the cheap/easy route and changed (deliberately) what the reported value was. They did this without going through the necessary steps of going back in and updating the spec and the docs. Probably because they wanted to avoid the work, overhead, and management red tape involved in doing so. If that's not intentionally lying, then I don't know what is.

None of that matters of course. All it means is that I can't use that Win32_NetworkAdapter class to get the information I need. And the MSFT_NetAdapter won't work on one of my target platforms because it's too new.

So now I need to figure out how to get that information. And I'm stumped.

Somewhere in the Windows API there has to be a way to do it. The "Network Connections" screen is able to reliably show whether or not a given network adapter is disabled by graying it out. So what function is THAT program using to gather that information? That's what I need to find out.
_________________________
Tony Fabris