VMware Cloud Community
LordofVxRail
Enthusiast
Enthusiast
Jump to solution

PowerCLI - Consolidate VM (within vApp) Chain Length

Hi All,

VMware Cloud Director version: 10.1.2.16779297 

 

So spent a good few hours searching and trying a few solutions across the web, and I can't seem to find a working example, 

ExtensionData.VCloudExtension.any.VirtualDisksMaxChainLength - doesn't seem to do anything for me

I'd like to be able to add to my workflow of deploying / modifying vapp (and vms) a step to Consolidate VM Chain Length.

 

any guidance or working examples of how I might approach this?  this is what I am referring to in UI

LordofVxRail_0-1628174714879.png

 

 

 

Reply
0 Kudos
1 Solution

Accepted Solutions
LordofVxRail
Enthusiast
Enthusiast
Jump to solution

one of my collages figured this out, all working as desired.

 


$vms = get-org $CIOrg | Get-CIVApp $CIVAppName | Get-CIVM | Get-CIView
foreach ($vm in $vms) {
echo $vm.Name
echo $vm.VCloudExtension.GetValue(0).any.VirtualDisksMaxChainLength
try {
$task = $vm.Consolidate_Task()
Start-Sleep 1
while ((Get-Task -Id $task.Id).State -ne "Success" ) {
#Report power state
Write-Output "$($VM.name) - Percent: $((Get-Task -Id $task.Id).PercentComplete) / State: $((Get-Task -Id $task.Id).State)"
Start-Sleep .5
}
}
catch {
Write-Output " $($VM.name) Failed!"
}
}

View solution in original post

Reply
0 Kudos
1 Reply
LordofVxRail
Enthusiast
Enthusiast
Jump to solution

one of my collages figured this out, all working as desired.

 


$vms = get-org $CIOrg | Get-CIVApp $CIVAppName | Get-CIVM | Get-CIView
foreach ($vm in $vms) {
echo $vm.Name
echo $vm.VCloudExtension.GetValue(0).any.VirtualDisksMaxChainLength
try {
$task = $vm.Consolidate_Task()
Start-Sleep 1
while ((Get-Task -Id $task.Id).State -ne "Success" ) {
#Report power state
Write-Output "$($VM.name) - Percent: $((Get-Task -Id $task.Id).PercentComplete) / State: $((Get-Task -Id $task.Id).State)"
Start-Sleep .5
}
}
catch {
Write-Output " $($VM.name) Failed!"
}
}

Reply
0 Kudos