Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env perl
use strict;
BEGIN { unshift(@INC, "/usr/lib/vmware-vcli/apps"); }
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
use FindBin;
use lib "$FindBin::Bin/../";
use VMware::VIRuntime;
use XML::LibXML;
use AppUtil::XMLInputUtil;
use AppUtil::HostUtil;
use Data::Dumper;
$ENV{'VI_PROTOCOL'} = "https";
$ENV{'VI_PORTNUMBER'} = "443";
$ENV{'VI_SERVER'} = "virtualcenter";
$ENV{'VI_SERVICEPATH'} = "/sdk";
$ENV{'VI_USERNAME'} = $ENV{'LOGNAME'};
$ENV{'VI_PASSWORD'} = $ENV{'WINDOWS_PASSWORD'};
Opts::parse();
Opts::validate();
Util::connect();
foreach my $dc (@{ Vim::find_entity_views( 'view_type' => 'Datacenter' ) }){
print $dc->name."\n";
}
Util::disconnect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.