VMware Cloud Community
Pete_Howarth
Enthusiast
Enthusiast

Migrate VM's from Current Datastore or Datastore Cluster to a new Datastore and Cluster

I'm looking for a powercli script that will migrate a group of VM's from a list from their current datastore or datastore cluster to a new datastore or datastore cluster maintaining the same disk format thick or thin that they currently have.

Thanks,

 

Pete

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership

What do you already have?


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

CaptPete3
Contributor
Contributor

Hey Luc - Sorry I haven't responded I was out for a few days.  I came up with the two scripts below and they're working.

 

foreach($vmlist in (Get-Content -Path C:\TEMP\vmlist.txt)){
$vm = Get-VM -Name $vmlist
Move-VM $vm -Datastore SVC_PRD_C01 -DiskStorageFormat Thin -RunAsync
}

 

or

##All VM's in a datastore cluster or datastore to another.
Get-VM -Datastore Source Datastore Name | Move-VM -Datastore Target Datastore -DiskStorageFormat thin -RunAsync

 

Reply
0 Kudos