如何在 Win32_PerfFormattedData_Tcpip_NetworkInterface 中查询特定的适配器? [英] How to query specific adapters in Win32_PerfFormattedData_Tcpip_NetworkInterface?

查看:38
本文介绍了如何在 Win32_PerfFormattedData_Tcpip_NetworkInterface 中查询特定的适配器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从 Win32_PerfFormattedData_Tcpip_NetworkInterface 查询特定适配器(最好基于 IP 地址)?我花了一段时间在谷歌上搜索这个问题,但我没有想出解决方案.

How can I query specific adapters (ideally based on the IP address) from Win32_PerfFormattedData_Tcpip_NetworkInterface? I've spent a while googling this issue, but I didn't come up with a solution.

我尝试使用 Win32_NetworkAdapter 和 Win32_NetworkAdapterConfiguration,但是,我无法将它们链接到性能数据.

I tried using Win32_NetworkAdapter and Win32_NetworkAdapterConfiguration, however, I cannot link these to the performance data.

由于我碰巧在某些系统上有多个网络适配器,我无法区分返回值属于哪个适配器 - 有什么想法吗?

As I happen to have more than one network adapter on certain systems I cannot differentiate which adapter the returned values belong to - any ideas?

推荐答案

我是这样做的.

  1. 查询您感兴趣的 Win32_NetworkAdapter 实例.
  2. 从每个 Win32_NetworkAdapter 中获取 'PNPDeviceID' 的值并将其附加到\HKLM\SYSTEM\CurrentControlSet\Enum\"以生成适配器信息的注册表路径.这是一个示例:\HKLM\SYSTEM\CurrentControlSet\Enum\PCI\VEN_8086&DEV_100E&SUBSYS_001E8086&REV_02\3&267A616A&0&18".
  3. 在上面派生的路径中查询注册表中的FriendlyName"键.
  4. 如果存在FriendlyName"键,则取其字符串值.如果未定义FriendlyName"键,则使用 Win32_NetworkAdapter 中Description"键的值.
  5. 采用您在第 4 步中得到的字符串,用下划线_"替换所有/"和#"实例.
  6. 第 5 步的结果字符串应与 Win32_PerfFormattedData_Tcpip_NetworkInterface 中的名称"属性匹配.

这篇关于如何在 Win32_PerfFormattedData_Tcpip_NetworkInterface 中查询特定的适配器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆