【发布时间】:2017-11-03 19:44:00
【问题描述】:
我有一个带有以下输出的 powershell 命令,命令输出显示每台机器的活动 NIC 适配器和 NIC 适配器名称不同。但我在这里看到的是,在一台服务器中,活动 NIC 适配器是本地连接,而在另一台服务器中是以太网。这在所有 VM 中都会有所不同
PS C:\> netsh interface ipv4 show interface |where { $_ -match '\sconnected' -and $_ -notmatch 'loopback'}
12 5 1500 connected **Local Area Connection**
PS C:\>
PS C:\> netsh interface ipv4 show interface |where { $_ -match '\sconnected' -and $_ -notmatch 'loopback'}
12 5 1500 connected **Ethernet**
PS C:\>
我只想捕获适配器名称(例如:本地连接\以太网等)。
谁能帮我修改命令,以便我得到没有任何空格的 NIC 适配器名称作为输出?
输出应该如下所示
Local Area Connection
Ethernet
Ethernet 2
【问题讨论】:
标签: powershell