PowerCLI: Migrate all vm’s on a datastore

PowerCLI is just awsome Smilie: :)

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
Category(s): PowerCLI, Powershell, VMware
Tags: , , , ,

Leave a Reply

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


This site uses Akismet to reduce spam. Learn how your comment data is processed.