One liner command to get VM list detail on Hyper-V Cluster

2
13804
Command prompt

In this post, I will share a command to get the VM list detail that includes VM Name, CPU Count, IP Addresses, VLAN ID, and Memory assigned. The command includes the command below:

  • Get-VM: This command gets the virtual machines from one or more Hyper-V hosts
  • Get-ClusterNode: This command to gets information about one or more nodes, or servers, in a failover cluster
  • Get-VMProcessor: This command to get the CPU count on the Virtual Machine
  • Get-VMNetworkAdapterVlan: This command gets the virtual LAN settings configured on a virtual network adapter.
  • Get-VMNetworkAdapter: This command to gets the Virtual Network Adapter on the VM

Here is the PowerShell command you can use to get the information from the VM

Get-VM –ComputerName (Get-ClusterNode) | Select Name,@{label='CPUCount';Expression={($_ | Get-VMProcessor).Count}},@{label='VLAN ID';Expression={($_ | Get-VMNetworkAdapterVlan).AccessVlanId}},@{label='Memory';Expression={($_.MemoryAssigned/1gb)}},@{label='IP Addresses';Expression={($_ | Get-VMNetworkAdapter).IPAddresses}}

We hope this article can help you to get VM list detail on Hyper-V Cluster. If you liked this article, then please share it with the others. You can also find us on Twitter and Facebook.

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here