I have several VC which I want to query. So instead of calling a script to connect to a specific VC using the VI_SERVER variable, can I place it somehow into the perl script? I'm kinda new to perl scripting so this may be obvious but can't find anything on google to answer my question...
Hi,
you can call the login directly per VC, but I'm not sure if you can have concurrent sessions.
use VMware::VIM2Runtime; use VMware::VILib; my $service_url_1 = "https://VC1/sdk"; my $service_url_1 = "https://VC2/sdk" my $username=""; my $password=""; Vim::login(service_url => $service_url_1, user_name => $username, password => $password); #do stuff on VC1 Vim::logout(); Vim::login(service_url => $service_url_2, user_name => $username, password => $password); #do stuff on VC2 Vim::logout();
-Stefan
Yes, you can talk to multiple VCs simultaneously.
Here's a reference to it:
In essence, you have to use the login method (rather than connect) and assign the result to a session variable.
You then prefix all queries (find_entity_views, get_entity_views) with the session variable (ie. $session1->get_entity_view) and voila.
H
Thanks so much for the help. Exactly what I was looking for!