Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 175326

Set VM Storage Policy to "Datastore Default"

$
0
0

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


Viewing all articles
Browse latest Browse all 175326

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>