PowerCLI: Migrate all vm’s on a datastore

PowerCLI is just awsome :)

This simple one-liner migrates all vm’s off one datastore to a new one:

Get-VM -Datastore <datastore1> | Move-VM -Datastore <datastore2>

You can also move vm’s off one datastore and place them in any datastore within a specified datastore cluster:

$DatastoreCluster1 = Get-DatastoreCluster -Name 'DatastoreCluster1'
Get-VM -Datastore <datastore1> | Move-VM -Datastore $DatastoreCluster1

Leave a Reply

Your email address will not be published. Required fields are marked *