答案1
电源外壳:
Get-NetAdapterBinding -IncludeHidden -AllBindings
VBScript(使用 WMI):
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\StandardCimv2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM MSFT_NetAdapterBindingSettingData",,48)
Wscript.Echo "Name,DisplayName,ComponentId,Enabled"
For Each objItem in colItems
Wscript.Echo objItem.Name & "," & objItem.DisplayName & "," & objItem.ComponentId & "," & objItem.Enabled
Next
世界移动通信大会(WMIC):
wmic /namespace:\\root\StandardCimv2 Path MSFT_NetAdapterBindingSettingData Get Name,DisplayName,ComponentId,Enabled
答案2
如何获取系统上每个网络适配器使用的组件列表。
您可以使用绑定(Microsoft Technet 应用程序)来检索确切地您所要求的信息。
nvspbind 是一款用于从命令行修改网络绑定的工具。它在启用 Hyper-V 角色的 Server Core 环境中特别有用。
...
有三种变体:
Microsoft_Nvspbind_package.EXE 是服务器核心的标准 64 位版本。
32bit_Nvspbind_package.EXE 是 32 位版本,适用于 Vista 及更新版本。
XP_Nvspbind_package.EXE 是功能减少的 32 位版本,适用于 XP 及更新版本。
来源Hyper-V 网络 VSP 绑定 (nvspbind)
我已经在 Windows 7 64 位上测试了 Microsoft_Nvspbind_package.EXE 版本,结果如下:
F:\temp>nvspbind.exe "Local Area Connection 2" > lan2.txt
F:\temp>type lan2.txt
Hyper-V Network VSP Bind Application 6.1.7725.0.
Copyright (c) Microsoft Corporation. All rights reserved.
Adapters:
{37C93C8F-EE9C-4268-A33F-DD199D18748E}
"usb\class_e0&subclass_01&prot_03"
"Remote NDIS based Internet Sharing Device"
"Local Area Connection 2":
enabled: ms_netbios (NetBIOS Interface)
disabled: ms_server (File and Printer Sharing for Microsoft Networks)
enabled: ms_pacer (QoS Packet Scheduler)
disabled: ms_ndiscap (NDIS Capture LightWeight Filter)
enabled: ms_wfplwf (WFP Lightweight Filter)
enabled: inspect (COMODO Internet Security Firewall Driver)
disabled: ms_msclient (Client for Microsoft Networks)
enabled: ms_tcpip6 (Internet Protocol Version 6 (TCP/IPv6))
enabled: ms_netbt (WINS Client(TCP/IP) Protocol)
enabled: ms_smb (Microsoft NetbiosSmb)
enabled: ms_tcpip (Internet Protocol Version 4 (TCP/IPv4))
enabled: ms_lltdio (Link-Layer Topology Discovery Mapper I/O Driver)
enabled: ms_rspndr (Link-Layer Topology Discovery Responder)
enabled: ms_pppoe (Point to Point Protocol Over Ethernet)
enabled: ms_ndisuio (NDIS Usermode I/O Protocol)
cleaning up...finished (0)
F:\temp>
答案3
作为更新,并为可能需要了解这一点的其他人提供示例,我想发布我找到了一种方法来采纳 DavidPostill 给出的建议,即通过下载带有 BITSAdmin(BITS 管理实用程序)的 NVSPBind。显然,BITSAdmin 从未从 Windows 中删除(它仍在 Windows 10 中,并且仍按预期执行此功能)。
我首先在 %TEMP% 中创建一个文件夹来保存下载的文件,如下所示:
MD "%TEMP%\NVSPBind"
一些 ECHO 命令可以在这里通知用户有关下载的信息,但在本示例中我们将跳过该命令并直接使用 BITSAdmin 下载 NVSPBind(请注意,优先级需要为“前台”才能立即运行下载):
BITSADMIN.EXE /TRANSFER "NVSPBind" /DOWNLOAD /PRIORITY FOREGROUND "https://gallery.technet.microsoft.com/Hyper-V-Network-VSP-Bind-cf937850/file/117119/1/32bit_Nvspbind_package.EXE" "%TEMP%\NVSPBind\32bit_Nvspbind_package.exe"
接下来我使用批处理文件提取 NVSPBind 文件:
"%TEMP%\NVSPBind\32BIT_NVSPBIND_PACKAGE.EXE" /Q /T:"%TEMP%\NVSPBind"
现在我们可以运行 NVSPBind,并让它将网络适配器和已安装组件的列表输出到我们的日志(我们假设日志保存到用户的桌面):
"%TEMP%\NVSPBind\NVSPBIND.EXE" *>>%UserProfile%\Desktop\Diagnostic_Log.txt
然后,当然,我让批处理文件自行清理并删除我们创建的 TEMP 文件夹和 NVSPBind 文件:
RD /S /Q "%TEMP%\NVSPBind"
上面的代码总体看起来是这样的:
MD "%TEMP%\NVSPBind"
BITSADMIN.EXE /TRANSFER "NVSPBind" /DOWNLOAD /PRIORITY FOREGROUND "https://gallery.technet.microsoft.com/Hyper-V-Network-VSP-Bind-cf937850/file/117119/1/32bit_Nvspbind_package.EXE" "%TEMP%\NVSPBind\32bit_Nvspbind_package.exe"
"%TEMP%\NVSPBind\32BIT_NVSPBIND_PACKAGE.EXE" /Q /T:"%TEMP%\NVSPBind"
"%TEMP%\NVSPBind\NVSPBIND.EXE" *>>%UserProfile%\Desktop\Diagnostic_Log.txt
RD /S /Q "%TEMP%\NVSPBind"
最终日志看起来类似以下内容:
Hyper-V Network VSP Bind Application 6.1.7725.0.
Copyright (c) Microsoft Corporation. All rights reserved.
Adapters:
{9C5B16F9-78E6-4434-BE8E-81D6903EB907}
"*teredo"
"Teredo Tunneling Pseudo-Interface"
"Local Area Connection* 9":
enabled: ms_netbios (NetBIOS Interface)
enabled: ms_server (File and Printer Sharing for Microsoft Networks)
enabled: ms_msclient (Client for Microsoft Networks)
enabled: ms_netbt (WINS Client(TCP/IP) Protocol)
enabled: ms_smb (Microsoft NetbiosSmb)
enabled: ms_tcpip6 (Internet Protocol Version 6 (TCP/IPv6))
enabled: ms_tcpip6_tunnel (Microsoft TCP/IP version 6 - Tunnels)
{F1C945CA-D4B9-4E09-90D1-66C5E85CC22E}
"*isatap"
"Microsoft ISATAP Adapter"
"isatap.{120652A1-8BD2-4435-BD9B-73B23DF7044B}":
enabled: ms_netbios (NetBIOS Interface)
enabled: ms_server (File and Printer Sharing for Microsoft Networks)
enabled: ms_msclient (Client for Microsoft Networks)
enabled: ms_netbt (WINS Client(TCP/IP) Protocol)
enabled: ms_smb (Microsoft NetbiosSmb)
enabled: ms_tcpip6 (Internet Protocol Version 6 (TCP/IPv6))
enabled: ms_tcpip6_tunnel (Microsoft TCP/IP version 6 - Tunnels)
{120652A1-8BD2-4435-BD9B-73B23DF7044B}
"pci\ven_8086&dev_100f"
"Intel(R) PRO/1000 MT Network Connection"
"Local Area Connection":
enabled: ms_netbios (NetBIOS Interface)
enabled: ms_server (File and Printer Sharing for Microsoft Networks)
enabled: ms_pacer (QoS Packet Scheduler)
disabled: ms_ndiscap (NDIS Capture LightWeight Filter)
enabled: ms_wfplwf (WFP Lightweight Filter)
enabled: ms_msclient (Client for Microsoft Networks)
enabled: ms_tcpip6 (Internet Protocol Version 6 (TCP/IPv6))
enabled: ms_netbt (WINS Client(TCP/IP) Protocol)
enabled: ms_smb (Microsoft NetbiosSmb)
enabled: ms_tcpip (Internet Protocol Version 4 (TCP/IPv4))
enabled: ms_lltdio (Link-Layer Topology Discovery Mapper I/O Driver)
enabled: ms_rspndr (Link-Layer Topology Discovery Responder)
enabled: ms_pppoe (Point to Point Protocol Over Ethernet)
enabled: ms_ndisuio (NDIS Usermode I/O Protocol)
...