sVmotion single files to another datastore PowerCLI oneliner

I needed to move a lot of VM disks from one to another datastore, and was too lazy to do it with the gui, and click on advanced etc.
So I created a nice oneline which helped me move them pretty good, (of course you can add -runasync) to do more disks simultaneously

get-HardDisk -vm (get-vm -Datastore "old_Datastore")|where {$_.filename -match "old_Datastore"} | Move-HardDisk -Datastore "New_Datastore" -confirm:$false

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.