用于获取 Windows 计算机网卡速度的 PowerShell 脚本 [英] PowerShell script to get network card speed of a Windows Computer

查看:71
本文介绍了用于获取 Windows 计算机网卡速度的 PowerShell 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取特定 Windows 计算机网卡运行速度的 PowerShell 脚本是什么?

What is the PowerShell script to get the speed a specific Windows machine's network card is running at?

我知道这可以通过基于 WMI 查询的语句来完成,一旦我解决了,就会发布答案.

I know this can be done with a WMI query based statement and will post an answer once I work it out.

推荐答案

一个基本的命令是

Get-WmiObject -ComputerName 'servername' -Class Win32_NetworkAdapter | `
    Where-Object { $_.Speed -ne $null -and $_.MACAddress -ne $null } | `
    Format-Table -Property SystemName,Name,NetConnectionID,Speed

请注意,ComputerName 参数采用一个数组,因此您可以在拥有权限的情况下在多台计算机上运行它.将 Format-Table 属性列表替换为 ***** 以获得更全面的可用属性列表.您可能希望过滤这些属性以去除您不感兴趣的条目.

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.

根据您的需要,使用内置的字节乘数后缀(MB、GB 等)还可以使速度更具可读性.您可以将其指定为 Format-Table -Property 数组上的 HashTable 条目,例如

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.

Format-Table -Property NetConnectionID,@{Label='Speed(GB)'; Expression = {$_.Speed/1GB}}

这篇关于用于获取 Windows 计算机网卡速度的 PowerShell 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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