Guv
Enthusiast
Enthusiast

Virtual machines on VMFS datastores.

I want to run a powershell script on a vmware cluster to list all the VM's which are on vmfs datastores.  We have a vmware cluster which has a mix of vmfs and nfs datastores, and want to move all the VM's off the vmfs datastores onto the nfs datastores, but first we need a list of the VM's which are on the vmfs datastore in a specific cluster.

Is this possible to run in a vmware powershell script.

Thanks

0 Kudos
5 Replies
LucD
Leadership
Leadership

Try like this

$clusterName = 'MyCLuster'

Get-Cluster -Name $clusterName | Get-Datastore |

where{$_.Type -eq 'VMFS'} | Get-VM


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Guv
Enthusiast
Enthusiast

I tried that but it errors with that the get-datastore cannot have the pipeline values.  I dont think there are any cluster switches with the get-datastore command.  anymore ideas on this.

Thanks

0 Kudos
LucD
Leadership
Leadership

Which PowerCLI version are you using ?

Do a Get-PowerCLIVersion.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Guv
Enthusiast
Enthusiast

Thanks for thr reply.

I am using vmware vsphere powercli 5.5 release 1.

Hop this helps

0 Kudos
LucD
Leadership
Leadership

Yes, can you upgrade your PowerCLI ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos