Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List VMs and their cluster

I'd like to be connected to multiple VIservers and list all the VMs + their respective clusters. Is this possible?

I've gotten as far as Get-VM | Select Name,VMHost. What property in place of VMHost would list the cluster?

like image 330
rafvasq Avatar asked Sep 04 '16 06:09

rafvasq


People also ask

What is a cluster of VMs?

A cluster of virtual machines across physical hosts (also known as a cluster across boxes) protects against software failures and hardware failures on the physical machine by placing the cluster nodes on separate ESXi hosts.

How do I list a VM in PowerShell?

To see all VMs on the local Hyper-V host, you should run the Get-VM cmdlet. On the PowerShell screen, you can see the list of available VMs, including their name, state, CPU usage, memory assigned, uptime, status, and version.

How do you find what virtual machines are running?

Type msinfo32 and press Enter. In the right pane, look for System Manufacturer for 'VMware, Inc. ' If this is present, you are running within a virtualized platform, and cannot install another virtualization product on top of it.

How do I find virtual machine properties in PowerShell?

$Data = @(); $VMs = Get-VM $VMName; foreach($VM in $VMs){ $VMCustom = New-Object System. Object; $VMCustom | Add-Member -Type NoteProperty -Name VMName -Value $VM. VMName; # Get-VMNetworkAdapter -VMName $VMName | Select -expand IPAddresses $VMCustom | Add-Member -Type NoteProperty -Name IPAddress -Value $VM. guest.


1 Answers

Try that

Get-VM | Select-Object -Property Name,@{Name=’Cluster’;Expression={$_.VMHost.Parent}}

which I found here

like image 170
DAXaholic Avatar answered Oct 23 '22 08:10

DAXaholic