简体   繁体   English

如何使用powershell仅获取hyper-V主机的网络适配器名称?

[英]How can I get only the name of Network adapter of a hyper-V host using powershell?

I am using the following command to get VMNetworkAdapter details:我正在使用以下命令获取 VMNetworkAdapter 详细信息:

Get-VMNetworkAdapter -ManagementOS

This provides output in the following format:这提供了以下格式的输出:

Name IsManagementOs VMName SwitchName名称 IsManagementOs VMName SwitchName

I just want the switch name.我只想要开关名称。 Do we have any option or flag?我们有任何选择或标志吗?

edit: I found the new command to just get switch details编辑:我找到了新命令来获取交换机详细信息

Get-VMSwitch

But this command also returns many fields, I want just the name of the switch.但是这个命令也返回很多字段,我只想要开关的名称。

只需要选择字段

Get-VMNetworkAdapter -ManagementOS|Select -ExpandProperty SwitchName

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM