21

There are a few ways you can list network interfaces via commandline. For example:

netsh interface show interface
netsh interface ip show interfaces
ipconfig |findstr "adapter"

For Mobile Broadband Connections:

netsh mbn show interfaces

All of those will list network interfaces as long as they are enabled. If you disable an interface (ie 'netsh interface set interface "interfaceName" admin=disable'), it will no longer be listed with those commands.

My question is this: how do you list an interface that has been disabled? Something that works for Mobile Broadband connections as well as regular connections would be great.

1
  • had to wait 8 hours to add my answer. i still don't know if my solution works for MBN connections though. I'll have to wait another 2 days to mark my answer as accepted
    – Lectrode
    Jul 15, 2013 at 7:53

4 Answers 4

17

I found this command seems to work:

wmic nic get NetConnectionID

It shows regular connection interfaces including those that have been disabled however it only shows the name of the interface.

netsh interface show interface will show:

Admin State (Enabled or Disabled) State (Connected or Disconnected) Type: (Dedicated) And Interface Name : (local Area Connection or Wireless)

1
  • I don't have an MBN connection to test. Does anyone know if this lists disabled Mobile Broadband connections?
    – Lectrode
    Jul 15, 2013 at 7:46
6

Make sure that you are using an elevated command-prompt, otherwise it won’t have access to everything and may not be able to show disabled interfaces as expected (figure 1). For example, I was unable to use the admin=disable parameter from a non-elevated prompt.

Technically, it should still be able to read the NICs from a non-elevated prompt—I was able to see all interfaces (figure 2) including disabled ones—so your system may have some policies or something in place that prevents it from working from a non-elevated one.


Figure 1: Screenshot of elevated command prompt showing disabled interfaces

Screenshot of elevated command prompt showing disabled interfaces

Figure 2: Screenshot of non-elevated command prompt showing disabled interfaces

Screenshot of non-elevated command prompt showing disabled interfaces

3

netsh interface ip show interfaces store=persistent will show some disabled interfaces (but it will not show some active ones). It seems that there are two interface "stores" - active, which contains active interfaces (including some that are not persistent and are probably recreated every time, like loopback), and persistent, which contains the inactive ones, but this is just my guessing

2

In PowerShell there are a few commansd that mirror the functionality of netsh interfaces discussed in other answers.

Get-NetAdapter seems to correspond to netsh interfaces show interfaces:

PS C:\> Get-NetAdapter

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
VirtualBox Host-Only ...2 VirtualBox Host-Only Ethernet Adap...#2      23 Up           XX-XX-XX-XX-XX-XX         1 Gbps
Ethernet                  TAP-Windows Adapter V9                       19 Disconnected XX-XX-XX-XX-XX-XX       100 Mbps
Local Area Connection 2   Realtek PCIe GBE Family Controller           17 Up           XX-XX-XX-XX-XX-XX         1 Gbps
NextDNS                   TAP-Windows Adapter V9 #2                    41 Disconnected XX-XX-XX-XX-XX-XX       100 Mbps

netsh interfaces ip show interfaces and netsh interfaces ipv6 show interfaces seem to be covered by Get-NetIPInterface:

PS C:\> Get-NetIPInterface

ifIndex InterfaceAlias                  AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp     ConnectionState PolicyStore
------- --------------                  ------------- ------------ --------------- ----     --------------- -----------
41      NextDNS                         IPv6                  1500              35 Enabled  Disconnected    ActiveStore
17      Local Area Connection 2         IPv6                  1500              25 Enabled  Connected       ActiveStore
1       Loopback Pseudo-Interface 1     IPv6            4294967295              75 Disabled Connected       ActiveStore
23      VirtualBox Host-Only Network #2 IPv6                  1500              25 Enabled  Connected       ActiveStore
19      Ethernet                        IPv6                  1500              35 Disabled Disconnected    ActiveStore
41      NextDNS                         IPv4                  1500                 Enabled  Disconnected    ActiveStore
17      Local Area Connection 2         IPv4                  1500              25 Enabled  Connected       ActiveStore
1       Loopback Pseudo-Interface 1     IPv4            4294967295              75 Disabled Connected       ActiveStore
23      VirtualBox Host-Only Network #2 IPv4                  1500              25 Disabled Connected       ActiveStore
19      Ethernet                        IPv4                  1500              35 Enabled  Disconnected    ActiveStore

And the persistent store can be viewed with the -PolicyStore option:

PS C:\> Get-NetIPInterface -PolicyStore persistentstore

ifIndex InterfaceAlias                  AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp     ConnectionState PolicyStore
------- --------------                  ------------- ------------ --------------- ----     --------------- -----------
16      Teredo Tunneling Pseudo-Inte... IPv6                  1280                                          Persiste...
41      NextDNS                         IPv6                                                                Persiste...
19      Ethernet                        IPv6                                                                Persiste...
23      VirtualBox Host-Only Network #2 IPv6                                                                Persiste...
5       Local Area Connection* 5        IPv6                                                                Persiste...
14      Local Area Connection* 3        IPv6                  1280                                          Persiste...
13      Local Area Connection* 4        IPv6                                                                Persiste...
10      Local Area Connection* 2        IPv6                  1280                                          Persiste...
18      Wireless Network Connection 3   IPv6                                                                Persiste...
20      Local Area Connection           IPv6                                                                Persiste...
17      Local Area Connection 2         IPv6                                                                Persiste...
15      Ethernet 2                      IPv6                                                                Persiste...
12      Bluetooth Network Connection 2  IPv6                                                                Persiste...
11      Wireless Network Connection     IPv6                                                                Persiste...
21      Wireless Network Connection 2   IPv6                                                                Persiste...
9       Local Area Connection* 1        IPv6                                                                Persiste...
22      VirtualBox Host-Only Network    IPv6                                                                Persiste...
41      NextDNS                         IPv4                                                                Persiste...
19      Ethernet                        IPv4                                                                Persiste...
23      VirtualBox Host-Only Network #2 IPv4                                                                Persiste...
18      Wireless Network Connection 3   IPv4                                                                Persiste...
20      Local Area Connection           IPv4                                                                Persiste...
17      Local Area Connection 2         IPv4                                                                Persiste...
15      Ethernet 2                      IPv4                                                                Persiste...
12      Bluetooth Network Connection 2  IPv4                                                                Persiste...
11      Wireless Network Connection     IPv4                                                                Persiste...
21      Wireless Network Connection 2   IPv4                                                                Persiste...
9       Local Area Connection* 1        IPv4                                                                Persiste...
22      VirtualBox Host-Only Network    IPv4                                                                Persiste...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .