用于获取 Windows 计算机网卡速度的 PowerShell 脚本
用于获取特定 Windows 计算机网卡运行速度的 PowerShell 脚本是什么?
我知道这可以通过基于 WMI 查询的语句来完成,并且一旦我解决了就会发布答案。
What is the PowerShell script to get the speed a specific Windows machine's network card is running at?
I know this can be done with a WMI query based statement and will post an answer once I work it out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
基本命令是
请注意,ComputerName 参数采用一个数组,因此您可以在拥有权限的多台计算机上运行此命令。将 Format-Table 属性列表替换为 ***** 以获取更全面的可用属性列表。您可能希望过滤这些属性以删除您不感兴趣的条目。
根据您的需要,使用内置的字节乘数后缀(MB、GB 等)也将使速度更具可读性。您可以将其指定为 Format-Table -Property 数组上的哈希表条目,例如
A basic command is
Note that the ComputerName parameter takes an array so you can run this against multiple computers provided you have rights. Replace the Format-Table property list with ***** to get a more comprehensive list of available properties. You might want to filter on these properties to get rid of entries you aren't interested in.
Using the built in byte Multiplier suffixes (MB, GB etc) would also make the speed more readable depending on your needs. You could specify this as a HashTable entry on the Format-Table -Property array e.g.
从 Windows 8/Server 2012 开始,您可以尝试
Get-NetAdapter
和几个更专业的命令,例如Get-NetAdapterAdvancedProperty
:https://learn.microsoft.com/en-us/powershell/module/netadapter/get-netadapter
您还可以使用更全面的 WMI 类
MSFT_NetAdapter
创建自定义输出。MSFT_NetAdapter
的描述如下:https://msdn.microsoft.com/en-us/library/Hh968170(v=VS.85).aspx
这是一个命令,用于列出已启用(状态 2)、已连接( OperationalStatusDownMediaDisconnected $false)、802.3 有线 (NdisPhysicalMedium 14)、本地计算机上的非虚拟适配器:
Starting with Windows 8/Server 2012, you can try
Get-NetAdapter
and several more specialized commands likeGet-NetAdapterAdvancedProperty
:https://learn.microsoft.com/en-us/powershell/module/netadapter/get-netadapter
You can also use the more comprehensive WMI class
MSFT_NetAdapter
to create customized output.MSFT_NetAdapter
is described here:https://msdn.microsoft.com/en-us/library/Hh968170(v=VS.85).aspx
Here's a command to list the speed and other properties of enabled (State 2), connected (OperationalStatusDownMediaDisconnected $false), 802.3 wired (NdisPhysicalMedium 14), non-virtual adapters on the local computer:
我当前的版本,取出蓝牙和无线卡(使用 powershell -file script.ps1 运行):
My current version, taking out bluetooth and wireless cards (run with powershell -file script.ps1):