A command to get the VM list detail that includes the following:
-
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 -
- On Local Server
Get-VM | ft 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}}
-
- On Remote Server
Get-VM -ComputerName $servername | ft 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}}
-
- On Cluster
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}}