How to determine if a network adapter is removable in Windows

How to find out if you managed to get this network adapter through Win32 GetAdaptersInfo () or GetAdaptersAddresses () functions are removable, such as USB, SmartCard, etc.

The documentation for these functions does not seem to contain any means to get this information, so I assume I need to go to Windows for every device I find, whether it is removable in any way.

What would you suggest?

+3
source share
1 answer

, (, PCI, USB, Virtual ..). BIOS.

, , " " . caption Win32_NetworkAdapterConfiguration. ( ), , , .

strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery( _
    "SELECT Caption, IPEnabled FROM Win32_NetworkAdapterConfiguration",,48) 
For Each objItem in colItems 
    Wscript.Echo objItem.IPEnabled & " " & objItem.Caption
Next

, Win32_NetworkAdapterConfiguration IPEnabled, , TCP/IP .

False [00000001] 1394 Net Adapter
False [00000002] RAS Async Adapter
False [00000003] WAN Miniport (L2TP)
False [00000004] WAN Miniport (PPTP)
False [00000005] WAN Miniport (PPPOE)
False [00000006] Direct Parallel
False [00000007] WAN Miniport (IP)
False [00000008] Packet Scheduler Miniport
True [00000009] Wireless-B PCI Adapter
False [00000010] Packet Scheduler Miniport
False [00000011] Cisco AnyConnect VPN Virtual Miniport Adapter for Windows
False [00000012] Packet Scheduler Miniport
+2

Source: https://habr.com/ru/post/1704952/


All Articles