Ashwani
Ashwani

Reputation: 1490

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:

Get-VMNetworkAdapter -ManagementOS

This provides output in the following format:

Name 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.

Upvotes: 0

Views: 901

Answers (1)

Vad
Vad

Reputation: 743

It's just need to select field

Get-VMNetworkAdapter -ManagementOS|Select -ExpandProperty SwitchName

Upvotes: 1

Related Questions