Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 252940

Need to retrieve all virtual servers by Resource Group and by Datastore

$
0
0

I need an export of all virtual servers, showing their current datastore, host name and the Resource Pool they are associated with. The aim is to be able to move all virtuals of a resource pool to a new datastore.

 

The current problem with this is that when I show all virtuals under a Resource Group in the VMware client, if the virtuals are on different hosts, I get the error:

 

The requested Storage vMotion would simulataneously change a virtual machine's storage placement and its execution host; however, this is not supported on the Source host MyVmWareHost.MyDomain.Com.

 

To get around this, if I can get a list of the virtual machines for a particular Resource Group, I can select the ones which are not on the same host, migrate them to one host, then be able to perform the datastore migration.

 

Here's what I have so far....

 

To get a list of virtual machines and their current datastore:

 

Get-Datacenter | Get-VM | %{$vm = $_ ; Get-Datastore -VM $vm | %{$vm.Name + "," + $_.Name} }

 

To get a list of virtual machines and their Resource Pool allocations:

 

get-resourcepool * | Get-VM | select name, resourcepool

 

I thus need to combine the two but I am not sure how to do this. I need the output to look like this:

 

Virtual Server Name, Current Datastore, Host Name, Parent Resource Pool

 

Can anyone help me with this? Thanks.


Viewing all articles
Browse latest Browse all 252940

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>