Hi,
I would like to remove a specific CIVM from a CIvApp. The CIvApp is stopped and powered off. The following bit of code works but performance is inconsistent. Sometimes it takes a few seconds, sometimes it takes extremely long to do 1 VM (1min 15 seconds). Even with the PowerCLI XmlSerializers installed. It's more than like it's because I'm using Get-CIVM.
Works:
$civapp = "Test" $civm = Get-CIVM -vApp $civapp -Name "VM1" $civm.ExtensionData.Delete()
I've tried using Search-Cloud but it appears I can't do anything with the object once I found it:
No ExtensionData property:
$civm2 = Search-Cloud -QueryType AdminVM -Filter "ContainerName==Test;Name==VM2"
I also thought about using Get-CIView and then using RecomposeVApp but I'm not sure what to pass that to delete a VM:
$civapp = "Test" $ciview = "get-ciview -ID $civApp.Id" $ciview.RecomposeVApp("VM2" ,deleteItem) //Not sure what to do here.
Or does anyone know of another method to delete CIVM's from a CIvApp via the SDK perhaps? Or maybe those mystical cloud views?
Thanks!