What I would like to do is disable a NIC based on the connection name (aka: what you see in the "network connections" window, or what you would use with netsh commands).
I know enabling/disabling can be done using devcon, however devcon identifies the device using the hardware ID of the physical NIC (e.g.: PCI\VEN_10EC&DEV_8139&SUBSYS_813910EC&REV_10\4&282B82B8&0&08F0
), not the name of the connection associated with it (e.g.: "Local area connection 2").
So basically I need something to map the connection name to the hardware ID of the device as returned by:
devcon listclass Net
Then disabling can be done via devcon.
Any idea on how to do that ? Any smarter/simpler way of doing that ?