WMIC命令无法返回网卡的速率信息

某个自动化的脚本,需要通过WMIC命令来读取网卡的speed信息,然而,有一台Windows Server 2019的实体机,这个命令却读不到网卡的speed信息。使用的命令如下:

wmic NIC where netenabled=true get speed,name,netconnectionid


尝试用WMIC命令直接修改,失败了。网上搜索了一番,也没有什么斩获。后来经过比对发现,这台机器跟其他机器的区别是,这台机器上开启了Hyper-V服务。


于是,禁用了Hyper-V之后,问题解决了,成功的获得了网卡的信息:

PS C:\Users\Administrator> wmic NIC where netenabled=true get speed,name,netconnectionid
Name                               NetConnectionID  Speed        

Mellanox ConnectX-5 Ex Adapter     SLOT 4 Port 1    100000000000 

Mellanox ConnectX-5 Ex Adapter #2  SLOT 4 Port 2    100000000000 


注意:

WMIC is deprecated as of Windows 10, version 21H1; and as of the 21H1 semi-annual channel release of Windows Server. This utility is superseded by Windows PowerShell for WMI; see Chapter 7 - Working with WMI.


This deprecation applies only to the WMIC utility. Windows Management Instrumentation (WMI) itself is not affected. Also see Windows 10 features we're no longer developing.


参考资料:

WMIC: WMI command-line utility

https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmic

wmic命令解析与实例

https://cloud.tencent.com/developer/article/1729656

Chapter 7 - Working with WMI

https://learn.microsoft.com/en-us/powershell/scripting/learn/ps101/07-working-with-wmi?view=powershell-7.4

posted on   中道学友  阅读(46)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
历史上的今天:
2009-10-30 汇编语言基础之二 - 各种寻址和过程进出简介
2009-10-30 汇编语言基础之一 - CPU架构和寄存器种类简介
2009-10-30 Windows Debugging之三
2009-10-30 在DataGridView中的CellEndEdit事件中删除当前行报错

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

技术追求准确,态度积极向上

点击右上角即可分享
微信分享提示