bezzat
April 3, 2023, 6:37am
1
hi
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) {
listDisk.push(vm.name);
listDisk.push(device.DeviceInfo.Summary);
listDisk.push(device.backing.fileName);
listDisk.push(device.DeviceInfo.Label);
listDisk.push(String(device.key));
listDisk.push(String(device.DiskObjectId));}
}
return (listDisk);
glennj
April 3, 2023, 11:41am
2
Without being able to see what that contains, we’ll be of limited help to you.
bezzat
April 3, 2023, 12:41pm
3
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
glennj
April 3, 2023, 1:40pm
4
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.