VMware Cloud Community
zdingelit
Contributor
Contributor

get all vmdk for a particular VM in vCAC

Hello,

I am trying  to get all vmdk with VCAC:VirtualMachine for a VM

I have tried many things but it doesn't works

scsi0-0-cvtest05.vmdk

scsi0-1-cvtest05_1.vmdk

Thanks !!!!

0 Kudos
1 Reply
iiliev
VMware Employee
VMware Employee

Hi,

For a VC:VirtualMachine, the following code may work (the input parameter is vm😞

for each (var device in vm.config.hardware.device) {

  if (device instanceof VcVirtualDisk) {

    System.log(device.backing.fileName);

  }

}

Now, the question becomes how to get vCAC:VirtualMachine from VC:VirtualMachine. There are several ways to do this; check this thread https://communities.vmware.com/thread/469612 for sample code snippets how it can be done.

0 Kudos