Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get MAC address of disabled NIC 1

Status
Not open for further replies.

mrmovie

Technical User
Oct 2, 2002
3,094
GB
hi all,

Win32_NetworkAdapter and Win32_NETADConfig .MACAddress is empty for a disabled nic. I thought i could go down the PNPEntity route...but dead end.

i guess all i need is another WMI class which holds MAC address info and have some sort of a property or associator of which links back to the NetworkAdap classes...anyone got any ideas???

cheers
von moyla
 
Have you tried the Win32_NetworkAdapterConfiguration class?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
yeah, thanks TTKP have looked at that and it shows up as an empty string, .MACAddress that is, when the nic is disabled (i.e network connections, right click disable NICConfig on the network connection which is relevant for the NIC)

i am confused, i was hoping that there would be a WMI class always available which would always hold the following NIC info:

MACAddress
PNPDeviceID

 
I suspect that WMI cannot query the NIC for its MAC address if the NIC is disabled.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
yeah that is what it is looking like, might end up having to enable every disabled NIC and then query its MAC to see if it is the one i want!!! crazy

what really gets me is that i though WMI came about due to WBEM which was designed for standard hardware format query, so the notion that if it is disabled in windows you cant see it seems crazy.....perhaps i should be looking at CIM classes rather than Win32..
 
You can. I took a quick look through the CIM classes and didn't see anything promising, but I wasn't particularly thorough.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
thanks for your input TTKP.
i will leave this topic for now. other pressing issues. ive scripted the disable and am just waiting for the 'can re-enable it' task. i can write a flaky registry key as a reference or go with the enable device and check if it was the right one etc, neither of which i like but will have to do for now
 
Wow, I thought you guys were crazy unitl I tested this myself. Very odd but disabling the NIC does seem to prevent WMI from getting the MAC address.

I hope you find this post helpful.

Regards,

Mark
 
it is very annoying Mark, something to do with Win32 classes being virtual and OS based, i think you are right about it being 'crazy'!!

i am sure it is hidden away somewhere
 
I agree MrMovie. I went digging int he registry to try and connect the two but did not find it. I will try to find out soe more if I can from some internal Microsoft resources.

Totally nuts in my opinion!

Disclaimer: the views expressed are my own and not necessarily that of my employer who I did not contact for an opinion. ;-)

I hope you find this post helpful.

Regards,

Mark
 
touchy subject M$ and me at the moment, LOL

thanks for feedback and interest, i will let you know if i find anything out myself

Regards,
Rich
 
OK, I did some digging and here is what I found out. WMI get the info by querying the NIC driver. When you disable the NIC, you disable the driver, so there is nothing for WMI to talk to; hence the observed behavior.

I hope you find this post helpful.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top