某个自动化的脚本,需要通过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 SpeedMellanox 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
标签:Windows,网卡,命令,WMI,WMIC,速率,speed From: https://www.cnblogs.com/awpatp/p/18515756