The resourceConfig.entity is a ManagedObjectReference, to get the name you'll have to Vim::get_view() against that moref.
But you could also do this a different way, such as using begin_entity in your find_entity_views() call.
use strict;
use warnings;
use VMware::VIRuntime;
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
my %opts = (
pool => {
type => "=s",
variable => "pool",
required => 1,
},
);
Opts::add_options(%opts);
Opts::parse();
Opts::validate();
Util::connect();
my $pool_name = Opts::get_option("pool");
my $pool_view = Vim::find_entity_view(view_type => "ResourcePool",
properties => ['name'],
filter => {'name' => $pool_name});
die "Failed to locate resource pool '$pool_name' in the vcenter inventory" unless $pool_view;
# Obtain all inventory objects of the specified type
my $e_vm = Vim::find_entity_views(view_type => 'VirtualMachine',
properties => ['name'],
begin_entity => $pool_view);
my $count = 0;
foreach (@$e_vm) {
my $vmName = $_->{'name'};
if (!($vmName =~ m/EdgeGW/i) && !($vmName =~ m/^vse/i)){
$count++;
} else {
print "Checking... VMName: ".$vmName."\n";
}
}
printf("TotalVMs:%d \n",$count);
Util::disconnect();