<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic put  connected server to variable in vSphere SDK for Perl Discussions</title>
    <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/put-connected-server-to-variable/m-p/338970#M191</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am busy with a script do some tasks, but i want to store the vCenter server to which i connect in a variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What was the best option for this? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Aug 2010 11:22:39 GMT</pubDate>
    <dc:creator>RobMokkink</dc:creator>
    <dc:date>2010-08-12T11:22:39Z</dc:date>
    <item>
      <title>put  connected server to variable</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/put-connected-server-to-variable/m-p/338970#M191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am busy with a script do some tasks, but i want to store the vCenter server to which i connect in a variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What was the best option for this? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Aug 2010 11:22:39 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/put-connected-server-to-variable/m-p/338970#M191</guid>
      <dc:creator>RobMokkink</dc:creator>
      <dc:date>2010-08-12T11:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: put  connected server to variable</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/put-connected-server-to-variable/m-p/338971#M192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mean the server IP/FQDN?  Or you want to store the VIM object so you can reuse it?  Basically the SOAP is all session based.  So long as your cookie based SID is saved you can reconnect.  But the Perl SDK has an a save session option just for that scenario.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Might need more information to understand what you're looking to do.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Aug 2010 14:00:41 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/put-connected-server-to-variable/m-p/338971#M192</guid>
      <dc:creator>stumpr</dc:creator>
      <dc:date>2010-08-12T14:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: put  connected server to variable</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/put-connected-server-to-variable/m-p/338972#M193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need the server vCenter server FQDN,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i am doing now is the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my $content = Vim::get_service_content();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my $vpxsetting = Vim::get-view(mo_ref =&amp;amp;gt; $content-&amp;amp;gt;setting);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my $query_vpx = $vpxsetting-&amp;amp;gt;QueryOptions(name=&amp;amp;gt;"VirtualCenter.InstanceName");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The $query_vpx is an array, but  i have some troubles getting the FQDN from this array.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's been to long since i last used perl for VMware.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Aug 2010 14:10:47 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/put-connected-server-to-variable/m-p/338972#M193</guid>
      <dc:creator>RobMokkink</dc:creator>
      <dc:date>2010-08-12T14:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: put  connected server to variable</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/put-connected-server-to-variable/m-p/338973#M194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can get the vCenter instance name by using that advanced key &lt;STRONG&gt;VirtualCenter.InstanceName&lt;/STRONG&gt; as you mentioned, but this is not guaranteed to match the actual hostname of your vCenter. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I understand you correctly and you're using vSphere SDK for Perl and you're already connected to vCenter server since you're querying for the advanced VPX configurations, you can actually get the IP or Hostname by doing the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="code"&gt;
my $server = Opts::get_option('server');
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VMware has already created a few modules that helps creating new vSphere SDK for Perl scripts and handles most of the authentication and by default you can access the username, password and server among other variables. So if you're already connecting to vCenter using IP or FQDN, you can just extract that variable out. Now if you want the full FQDN and you're connecting via IP, then just use Perl to do a reverse lookup, assuming DNS is fully functional in your environment as it should be. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=========================================================================&lt;/P&gt;&lt;P&gt;William Lam&lt;/P&gt;&lt;P&gt;VMware vExpert 2009,2010&lt;/P&gt;&lt;P&gt;VMware scripts and resources at: &lt;A href="http://www.virtuallyghetto.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://twitter.com/lamw"&gt;Twitter: @lamw&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.vmware.com/d-9852"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.virtuallyghetto.com/2010/05/getting-started-with-vma.html"&gt;Getting Started with the vMA (tips/tricks)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.virtuallyghetto.com/2010/05/getting-started-with-vsphere-sdk-for.html"&gt;Getting Started with the vSphere SDK for Perl&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.vmware.com/c-3164"&gt;VMware Code Central - Scripts/Sample code for Developers and Administrators&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.vmware.com/c-2828"&gt;VMware Developer Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you find this information useful, please award points for "correct" or "helpful".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Aug 2010 16:04:38 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/put-connected-server-to-variable/m-p/338973#M194</guid>
      <dc:creator>lamw</dc:creator>
      <dc:date>2010-08-12T16:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: put  connected server to variable</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/put-connected-server-to-variable/m-p/338974#M195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, Why didn it hink of that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I has been a while ago since i last used perl for vmware. I  am a bit rusty  :smileygrin:  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Aug 2010 16:23:15 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/put-connected-server-to-variable/m-p/338974#M195</guid>
      <dc:creator>RobMokkink</dc:creator>
      <dc:date>2010-08-12T16:23:15Z</dc:date>
    </item>
  </channel>
</rss>

