Hi All,
I'm attempting to script the mass movement of VMs to new datastores that will be part of a datastore cluster. When I Google this it seems I should be able to specify a datastore cluster object for the -datastore parameter in the Move-VM commandlet, yet when I do I get an error "Could not find StorageResource" even though I pass a valid object.
Can anyone confirm whether this should work (or not)? I'm using PowerCLI 5.8 if it makes a difference.
Thanks for your help.
can you post your code? Thanks!
It's really simple:
$task = Move-VM -VM $mvm -Datastore -$dclobj -RunAsync |
How are you getting that data store?
$myDatastoreCluster1 = Get-DatastoreCluster -Name 'MyDatastoreCluster1'
Move-VM -VM 'MyVM1' -Datastore $myDatastoreCluster1
Yep, nothing special
$dclobj = Get-DatastoreCluster -name $dcl |
Both passed parameters are valid. When it comes down to it Move-VM doesn't seem to accept a datastorecluster object as valid. I was hoping someone could tell me definitively if it should be accepted or not. Maybe a different version of PowerCLI will accept it?
I have multiple VMs that are very large and span multiple datastores; I was hoping to use a cluster so that it would handle placing the vmdk's on the back-end, as opposed to me trying to do coding acrobatics to make it work (or doing it manually).
Can you post the error?
Which PowerCLI version are you running? (do a Get-PowerCLIVersion)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I am also curious what version of vCenter/ESX.
If you copied and pasted the actual code you used, you have a '-' in front of your datastore object name -Datastore -$dclobj . That would be your problem if it were that simple.