我正試圖讀取網路配接器速度設定的有效值,但看起來PowerShell并沒有輸出所有的值。根據GUI網路配接器設定視窗,PowerShell輸出的值串列中缺少 "100Mbps全雙工 "和 "1000Mbps全雙工"。
PS> Get-NetAdapterAdvancedProperty Ethernet -Displayname 'Link Speed &; Duplex'/span>| fl ValidDisplayValues
ValidDisplayValues : {Auto Negotiation, 10 Mbps Half Duplex, 10 Mbps Full Duplex, 100 Mbps Half Duplex...}。
我試著玩了一下ft out-string和write-host,但是沒有任何收獲。我怎樣才能輸出一個完整的串列呢?
更新:我已經嘗試在我的網路配接器速度設定中加入GUI視圖,以便更好地了解我的問題。
uj5u.com熱心網友回復:
我想你正在尋找Select-Object的-ExpandProperty
Get-NetAdapterAdvancedProperty| where DisplayName -like '*speed*' |
select -first 1 -ExpandProperty ValidDisplayValues
自動協商
10 Mbps半雙工
10 Mbps Full 雙工
100 Mbps半雙工
100 Mbps Full 雙工
1.0 Gbps Full 雙工
但是,更通用的查詢方法是使用注冊表名稱而不是DisplayName(應該是本地化的)。
Get-NetAdapterAdvancedProperty | where RegistryKeyWord -eq '*SpeedDuplex' |
select -ExpandProperty ValidDisplayValues
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/326676.html
標籤:
