Issue found when reporting number of network cards in system

(imported topic written by JesseR91)

I was doing a report on a group of servers, about 100 of them, showing the number of network cards in the system. The reference code in the analysis used for this was: descriptions of adapters of network

The problem I just found (after submitting the report and finding this problem) is that if there are any DISABLED network cards, they will NOT be reported. How can this be solved? Should I just query the WMI directly to do this and not use the BigFix reference table?

(imported comment written by BenKus)

Hey JesseR,

Interesting… I will file a bug on this…

Until we adjust the relevance, you can use this:

string values of selects “Description from Win32_networkadapter where PhysicalAdapter=True” of wmi

Ben

(imported comment written by JesseR91)

I get an out of memory with that relevance. Do you?

(imported comment written by JesseR91)

I am really close here. The relevance

(if exists string value of property “NetConnectionID” of it then string value of property “Name” of it else “N/A”)of (select objects (“Name, NetConnectionID FROM Win32_networkadapter”) of wmi)

Shows the results as

HP NC3163 Fast Ethernet NIC

HP NC7170 Dual Gigabit Server Adapter

HP NC7170 Dual Gigabit Server Adapter

HP NC3123 Fast Ethernet NIC

N/A

N/A

N/A

N/A

N/A

N/A

N/A

How can I tell the relevance to ‘quit’ once it finds the there is no NetConnectionID value? Looks like all adapters, even if they are disabled, are assigned a NetConnectionID (the label of the connection). I tried your above code and changed PhysicalAdapter to NetConnectionID but realized that would not work either since NetConnectionID is not a boolean. Any ideas? I am close here :stuck_out_tongue:

(imported comment written by BenKus)

You want to get rid of the "N/A"s?

Try this:

q: string values of properties “Name” of (select objects (“Name, NetConnectionID FROM Win32_networkadapter”) of wmi) whose (exists string value of property “NetConnectionID” of it )

Ben

(imported comment written by JesseR91)

Guess thats why they pay you the big bucks! Thanks Ben

(imported comment written by BenKus)

I just found out that the issue with the “Disabled Adapters not showing” is by design according to the Windows API that the Network Adapter uses… so this is a “feature” and not a bug… :slight_smile:

Ben

(imported comment written by rkc91)

Folks

using this how does one identify wireless nic and there driver version

(imported comment written by rkc91)

I can get till here

string values of properties “Name” of (select objects ("Name, NetConnectionID FROM Win32_networkadapter ")

of wmi) whose (string value of property “NetConnectionID” of it contains “Wireless Network Connection” )

need to know how to extract driver info.

(imported comment written by JesseR91)

rkc, you can use the below relevance to retrieve driver versions.

( ( value “DisplayName” of it as string ) & " # " & ( ( version of file ( pathname of windows folder & “” & ( value “ImagePath” of it as string ) ) ) as string )) of keys ( ( “HKLM\SYSTEM\CurrentControlSet\Services” & service key value name of it ) of active devices whose ( ( class of it = “Net” ) AND ( exists location information of it ) ) ) of registry as string

(imported comment written by rkc91)

Thanks Jesse

But this give me both physical and wireless how do I get just the wireless

(imported comment written by JesseR91)

Good question. I think it would a whose/contains statement but having trouble working it. Maybe Ben knows. I’ll still try and figure it out.

Ben,

Can you provide some details about the API? I have a user who is insisting this is the incorrect way of getting the network adapters.

Thanks.

-c