Reputation: 3384
Update: The preferred solution would be something that uses the VmWare toolkit for .NET and achieves the following
One of the tasks that we now need to perform (if possible) is to toggle the virtual hard disks from non-persistent to persistent mode and vice versa.
I have tried looking for the correct API calls but haven't found any yet. Does anyone know if this can be done via the API calls?
Upvotes: 0
Views: 1358
Reputation: 172
Although I haven't done this exact operation, I have done similar operations through the ReconfigVm task: http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.VirtualMachine.html#reconfigure
You will need to set up a VirtualMachineConfigSpec with an upodated VirtualDevice whose VirtualDeviceBackingInfo has the desired persistence type in its diskMode attribute. The data objects are documented here:
http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.ConfigSpec.html
Upvotes: 1
Reputation: 12743
According to the VMware vSphere PowerCLI Cmdlets Reference, this should do the job:
Get-HardDisk -VM $myVM | Set-HardDisk -Persistence "Independent(Non)Persistent"
Upvotes: 1