Automation

 View Only

push array property - view disk

  • 1.  push array property - view disk

    Posted Apr 03, 2023 09:05 AM

    HI 

    I write a a Script  in JavaScript to put all disk info from VM ( one VM) 

    the script work well but its show all the output as a String and I need to view like array property 

    how can you help me to fix my script 

    this is my script

    //////////////////////////////////////////////

    var list = new Array();
    var myWord = 'disk';

    for each(device in vm.config.hardware.device){
    var str = device.DeviceInfo.Label;

    if(str.indexOf(myWord) !== -1){
    list.push(vm.name);
    list.push(device.DeviceInfo.Summary); 
    list.push(device.backing.fileName); 
    list.push(device.DeviceInfo.Label); 
    list.push(String(device.key)) ; 
    list.push(String(device.DiskObjectId));
          
    }
    }
    return (list);
    //////////////////////////////////