Trondesson
Contributor
Contributor

The following code prints the Name of the VirtualMachine that has an value for the custom field, but it don't print the value as well.

my $vms = Vim::find_entity_views(view_type => 'VirtualMachine', properties => ['summary.customValue','name',], );

for my $vm (@$vms) {

        my $cv_ref = $vm->{'summery.customValue'};

        next unless defined($vm->{'summary.customValue'});

        print $vm->name . "\n";

        for (@$cv_ref) {

                next unless defined $_->value;

                print "key: ",$_->key,"\tvalue: ",$_->value,"\n";

        }

}

Reply
0 Kudos