How can I set the Storage Policy to "Datastore Default" ?
I know how to set based on a specific profile ID but I don't know what is the "Datastore Default" ID.
I found the PowerCLI script https://communities.vmware.com/thread/583674:
$vmName = 'MyVM'
Get-VM -Name $vmName | Get-HardDisk | %{
Get-SpbmEntityConfiguration -HardDisk $_ |
Set-SpbmEntityConfiguration -StoragePolicy $null -Confirm:$false
}
with JavaScript is not working in this way:
profileUniqueId = null;
var deviceChangeSpec = [];
var changeSpec = [];
var myVcVirtualMachineConfigSpec = new VcVirtualMachineConfigSpec() ;
var myVcVirtualMachineDefinedProfileSpec = new VcVirtualMachineDefinedProfileSpec() ;
myVcVirtualMachineDefinedProfileSpec.profileId = profileUniqueId;
changeSpec.push(myVcVirtualMachineDefinedProfileSpec);
myVcVirtualMachineConfigSpec.vmProfile = changeSpec;
I receive the error:
"com.vmware.vim.vmomi.core.exception.MarshallException: VirtualMachineDefinedProfileSpec required property profileId not set"
What is the right approach with vRO?
Thanks