Report disks info with array property in Javascript

I write a script in Javascript that repot all Disk info from one VM
the list I get as a string
and I need to get the all disk like a group like array property

this is my script
var listDisk = new Array();
var myWord = ‘disk’;

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

if(str.indexOf(myWord) !== -1) {








return (listDisk);

Without being able to see what that contains, we’ll be of limited help to you.

its like this

0 vmnamekuku1 string
1 157,286,400 KB string
2 location vmdk on storage .vmdk string
3 Hard disk 1 string
4 2000 string
5 39-2000 string
6 vmnamekuku1 string
7 4,194,304 KB string
8 location vmdk on storage .vmdk string
9 Hard disk 2 string
10 2001 string
11 39-2001 string
12 vmnamekuku1 string
13 2,097,152 KB string
14 location vmdk on storage .vmdk string
15 Hard disk 3 string
16 2002 string
17 39-2002 string
18 vmnamekuku1 string
19 3,145,728 KB string
20 location vmdk on storage .vmdk string
21 Hard disk 4 string
22 2003 string
23 39-2003 string

I need that report in array by every Disk
This means that each group of disks will be separate

Really? Then what is device.DeviceInfo.Summary supposed to be?

You need to step back and rethink how you’re asking your question. I bet you’ll get much better help on stackoverflow.

ok thank you