Monthly Archives: October 2014

Hot Modify disks in vCloud Director using PowerCLI

I did not write this script, I found it on this excellent blog, I had a few problems getting the original code to work so thought I would share what I used to get this working. The script below increases the disk size to 70GB on a powered on VM.


Connect-CIServer vcloud.site.com -User administrator -Password password 

#Get VM called diskresize
$vm = Get-CIVM diskresize

#Define new size in MB
$newsize = "70240" 

#Modify the extension data with the new size
(($vm.ExtensionData.Section|where {$_-is  [VMware.VimAutomation.Cloud.Views.OvfVirtualHardwareSection]}).item|where {$_.ResourceType.value-eq17}).hostresource[0].AnyAttr[0]."#text" = $newsize

# Final step, update server data
($vm.ExtensionData.Section|where {$_-is[VMware.VimAutomation.Cloud.Views.OvfVirtualHardwareSection]}).updateserverdata()