I have tried and search multiple way to migrate VM's to different data store
$existingds = Get-Content dummy path
$newds = Get-Content dummypath
Get-Datastore $existingds | Get-VM | Move-VM -DiskStorageFormat Thick -Datastore $newds –RunAsync
But for some reason, it is not working, I'm getting this error:
Move-VM : Cannot convert 'System.Object[]' to the type 'VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.StorageResource' required by parameter 'Datastore'. Specified method is not
supported.
If I run the command move-vm -vm vmname -datastore new datastore
, it works without issue but when I try to put into an array, it throws an error.