Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 219035

Re: Error: Can't call method "macAddress" on unblessed reference

$
0
0

Why doesnt this work - To find ipAddresses from all VMs on and ESXi host?

 

#!/usr/bin/perl -w

use strict;

use warnings;

use VMware::VIRuntime;

use VMware::VILib;

 

# validate options, and connect to the server

Opts::parse();

Opts::validate();

Util::connect();

 

my $vm_view = Vim::find_entity_views(view_type => 'VirtualMachine');

 

foreach my $vm (@$vm_view) {

        my $vm_name = $vm->summary->config->name;

        my $nets= $vm->guest->net;

foreach my $net(@$nets) {

print $vm_name . "\n" . $net->{ipAddress} . "\n";

}

}

Util::disconnect();


Viewing all articles
Browse latest Browse all 219035

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>