I've created a Script to move VM's over the vCloud Director API to an other Datastore in the same PvDC. (Datastore with the lowest UsedSpace)
Here the most important parts:
$civm = get-civm <VMName>
$datastore = $civm.Orgvdc.ProviderVdc | Get-CIDatastore | Where-Object {$_.Name -like "<search Criteria>"} | Sort-Object UsedSpaceGB | Select-Object -First 1
$civm.ExtensionData.Relocate($datastore.href)
But when I try to move a vShield Edge, I get the following error:
Exception calling "Relocate" with "1" argument(s): "Access is forbidden"
The same error I get when I try to move a template in the catalog.
$template = get-org <org> | get-catalog | Get-CIVAppTemplate <name>
$template.ExtensionData.Relocate($datastore.href)
How can I move Edges and Templates over the vCloud API with Powershell?
I don't would like to do it directly over vSphere because we have a strechted cluster and 2 ProviderVDC's that have seperated datastores. When our support is moving the VM's in vSphere to a wrong datastores, the vCloud Director can't find the VM anymore. Over the API of the vCloud Director this will be checked by default from VMWare.
Thanks for your help.