<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:clearspace="http://www.jivesoftware.com/xmlns/clearspace/rss" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>VMware Communities: Message List - Connecting to hosts recently used using a menu interface.</title>
    <link>http://communities.vmware.com/community/vmtn/vsphere/automationtools/windows_toolkit?view=discussions</link>
    <description>Most recent forum messages</description>
    <language>en</language>
    <pubDate>Fri, 15 Aug 2008 18:27:08 GMT</pubDate>
    <generator>Clearspace 1.10.12 (http://jivesoftware.com/products/clearspace/)</generator>
    <dc:date>2008-08-15T18:27:08Z</dc:date>
    <dc:language>en</dc:language>
    <item>
      <title>Re: Connecting to hosts recently use using a menu interface.</title>
      <link>http://communities.vmware.com/message/1025020?tstart=0#1025020</link>
      <description>This one works on both 2.0 and 2.5 clients&lt;br /&gt;
Thanks</description>
      <pubDate>Fri, 15 Aug 2008 18:27:08 GMT</pubDate>
      <author>sanmad</author>
      <guid>http://communities.vmware.com/message/1025020?tstart=0#1025020</guid>
      <dc:date>2008-08-15T18:27:08Z</dc:date>
      <clearspace:dateToText>1 year, 3 months ago</clearspace:dateToText>
    </item>
    <item>
      <title>Connecting to hosts recently used using a menu interface.</title>
      <link>http://communities.vmware.com/message/1024019?tstart=0#1024019</link>
      <description>If you have a lot of hosts that you connect to it can be frustrating to remember them all. Since I have this problem I wrote this function to help deal with it. If you use the VI Client, connections are stored in the registry. This function reads these entries and presents you with a menu where you can select the host you want to connect to. Hopefully the forum doesn't mangle the code too much. I copied this into my Initialize-VIToolkitEnvironment.ps1 file so I get it automatically on startup.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="jive-pre"&gt;&lt;code class="jive-code jive-plain"&gt;function Connect-Recent {
	$local:ErrorActionPreference = &amp;quot;SilentlyContinue&amp;quot;
	$recent = (Get-Itemproperty &amp;quot;hkcu:\software\vmware\VMware Infrastructure Client\Preferences&amp;quot;).RecentConnections
	if ($recent -eq $null) {
		$recent = (Get-Itemproperty &amp;quot;hkcu:\software\vmware\Virtual Infrastructure Client\Preferences&amp;quot;).RecentConnections
	}
	if ($recent -eq $null) {
		write-host -fore red &amp;quot;No recent hosts defined.&amp;quot;
		return
	}

	$recents = $recent.split(&amp;quot;,&amp;quot;)

	write-host -fore yellow &amp;quot;Your recently visited hosts are:&amp;quot;
	$max = 10
	if ($recents.length -lt $max) {
		$max = $recents.length
	}
	for ($i = 1; $i -lt $max+1; $i++) {
		write-host -n &amp;quot;[&amp;quot;
		write-host -n -f yellow &amp;quot;$i&amp;quot;
		write-host &amp;quot;]&amp;quot;, $recents[$i-1]
	}

	$selection = 0
	while ($selection -gt $max -or $selection -lt 1) {
		$selection = [int](read-host &amp;quot;Select a host to connect to&amp;quot;)
	}
	write-host -fore yellow &amp;quot;Connecting to&amp;quot;, $recents[$selection-1]
	connect-viserver $recents[$selection-1]
	$global:defaultVIServer = $defaultVIServer
}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Here's what it looks like in action:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="jive-pre"&gt;&lt;code class="jive-code jive-java"&gt;PS C:\&amp;gt; connect-recent
[1] 10.16.83.242
[2] 10.21.10.80
[3] 10.16.83.241
[4] 192.168.217.130
[5] 192.168.217.135
[6] pmstaff-esx1.eng.vmware.com
[7] 10.17.25.73
[8] 192.168.217.131
[9] 192.168.217.129
[10] 10.16.83.240
Select a host: 1
Connecting to 10.16.83.242
There were one or more problems with the server certificate:
 
* The certificate&lt;font color="navy"&gt;'s CN name does not match the passed value.&lt;/font&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Thu, 14 Aug 2008 19:30:52 GMT</pubDate>
      <author>c_shanklin</author>
      <guid>http://communities.vmware.com/message/1024019?tstart=0#1024019</guid>
      <dc:date>2008-08-14T19:30:52Z</dc:date>
      <clearspace:dateToText>1 year, 3 months ago</clearspace:dateToText>
      <clearspace:replyCount>9</clearspace:replyCount>
    </item>
    <item>
      <title>Re: Connecting to hosts recently use using a menu interface.</title>
      <link>http://communities.vmware.com/message/1024984?tstart=0#1024984</link>
      <description>Can you try the latest version I posted (I edited the first message)? I think it will support both 2.5 and 2.0 clients.</description>
      <pubDate>Fri, 15 Aug 2008 18:11:40 GMT</pubDate>
      <author>c_shanklin</author>
      <guid>http://communities.vmware.com/message/1024984?tstart=0#1024984</guid>
      <dc:date>2008-08-15T18:11:40Z</dc:date>
      <clearspace:dateToText>1 year, 3 months ago</clearspace:dateToText>
      <clearspace:replyCount>1</clearspace:replyCount>
    </item>
    <item>
      <title>Re: Connecting to hosts recently use using a menu interface.</title>
      <link>http://communities.vmware.com/message/1024090?tstart=0#1024090</link>
      <description>Edited: See the first message, there were too many versions floating around.</description>
      <pubDate>Thu, 14 Aug 2008 20:44:42 GMT</pubDate>
      <author>c_shanklin</author>
      <guid>http://communities.vmware.com/message/1024090?tstart=0#1024090</guid>
      <dc:date>2008-08-14T20:44:42Z</dc:date>
      <clearspace:dateToText>1 year, 3 months ago</clearspace:dateToText>
    </item>
    <item>
      <title>Re: Connecting to hosts recently use using a menu interface.</title>
      <link>http://communities.vmware.com/message/1025011?tstart=0#1025011</link>
      <description>I have Version 2.0.1 build 32042.on one of the machines I use and this one has the key hkcu:\software\vmware\Virtual Infrastructure Client\Preferences.</description>
      <pubDate>Fri, 15 Aug 2008 18:07:07 GMT</pubDate>
      <author>sanmad</author>
      <guid>http://communities.vmware.com/message/1025011?tstart=0#1025011</guid>
      <dc:date>2008-08-15T18:07:07Z</dc:date>
      <clearspace:dateToText>1 year, 3 months ago</clearspace:dateToText>
      <clearspace:replyCount>2</clearspace:replyCount>
    </item>
    <item>
      <title>Re: Connecting to hosts recently use using a menu interface.</title>
      <link>http://communities.vmware.com/message/1024979?tstart=0#1024979</link>
      <description>&lt;div class="jive-quote"&gt;&lt;span class="jive-quote-header"&gt;sanmad wrote:&lt;/span&gt;the registry key is hkcu:\software\vmware\Virtual Infrastructure Client\Preferences&lt;/div&gt;
That's strange, I have both. What client version do you run?</description>
      <pubDate>Fri, 15 Aug 2008 17:52:03 GMT</pubDate>
      <author>c_shanklin</author>
      <guid>http://communities.vmware.com/message/1024979?tstart=0#1024979</guid>
      <dc:date>2008-08-15T17:52:03Z</dc:date>
      <clearspace:dateToText>1 year, 3 months ago</clearspace:dateToText>
      <clearspace:replyCount>3</clearspace:replyCount>
    </item>
    <item>
      <title>Re: Connecting to hosts recently use using a menu interface.</title>
      <link>http://communities.vmware.com/message/1024955?tstart=0#1024955</link>
      <description>the registry key is hkcu:\software\vmware\Virtual Infrastructure Client\Preferences</description>
      <pubDate>Fri, 15 Aug 2008 17:47:10 GMT</pubDate>
      <author>sanmad</author>
      <guid>http://communities.vmware.com/message/1024955?tstart=0#1024955</guid>
      <dc:date>2008-08-15T17:47:10Z</dc:date>
      <clearspace:dateToText>1 year, 3 months ago</clearspace:dateToText>
      <clearspace:replyCount>4</clearspace:replyCount>
    </item>
    <item>
      <title>Re: Connecting to hosts recently use using a menu interface.</title>
      <link>http://communities.vmware.com/message/1024897?tstart=0#1024897</link>
      <description>The original code was broken in a few ways, so I've updated the original post.</description>
      <pubDate>Fri, 15 Aug 2008 16:46:24 GMT</pubDate>
      <author>c_shanklin</author>
      <guid>http://communities.vmware.com/message/1024897?tstart=0#1024897</guid>
      <dc:date>2008-08-15T16:46:24Z</dc:date>
      <clearspace:dateToText>1 year, 3 months ago</clearspace:dateToText>
      <clearspace:replyCount>5</clearspace:replyCount>
    </item>
    <item>
      <title>Re: Connecting to hosts recently use using a menu interface.</title>
      <link>http://communities.vmware.com/message/1024701?tstart=0#1024701</link>
      <description>&lt;br /&gt;
The line:&lt;br /&gt;
&lt;p /&gt;
 while ($selection -gt $recent.length+1 -or $selection -lt 1) {&lt;br /&gt;
&lt;p /&gt;
Should  be&lt;br /&gt;
&lt;p /&gt;
while ($selection -gt $recent&lt;span style="color:#ff0000"&gt;&lt;b&gt;s&lt;/b&gt;&lt;/span&gt;.length+1 -or $selection -lt 1) {&lt;br /&gt;
&lt;p /&gt;
Otherwise it will only select the first host.&lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;br /&gt;</description>
      <pubDate>Fri, 15 Aug 2008 13:43:54 GMT</pubDate>
      <author>mcorry</author>
      <guid>http://communities.vmware.com/message/1024701?tstart=0#1024701</guid>
      <dc:date>2008-08-15T13:43:54Z</dc:date>
      <clearspace:dateToText>1 year, 3 months ago</clearspace:dateToText>
      <clearspace:replyCount>6</clearspace:replyCount>
    </item>
    <item>
      <title>Re: Connecting to hosts recently use using a menu interface.</title>
      <link>http://communities.vmware.com/message/1024049?tstart=0#1024049</link>
      <description>Hey, that is sweet.  I may have to set an upper bound on it for me, it pulled up 33 hosts.  &lt;img class="jive-emoticon" border="0" src="http://communities.vmware.com/images/emoticons/happy.gif" alt=":)" /&gt;&lt;br /&gt;
&lt;br /&gt;
Author of the upcoming book: &lt;a class="jive-link-external" href="http://sapienpress.com/vmware.asp"&gt;Managing VMware Infrastructure with PowerShell&lt;/a&gt;&lt;br /&gt;
Co-Host, PowerScripting Podcast (&lt;a class="jive-link-external" href="http://powerscripting.net"&gt;http://powerscripting.net&lt;/a&gt;)</description>
      <pubDate>Thu, 14 Aug 2008 19:49:01 GMT</pubDate>
      <author>halr9000</author>
      <guid>http://communities.vmware.com/message/1024049?tstart=0#1024049</guid>
      <dc:date>2008-08-14T19:49:01Z</dc:date>
      <clearspace:dateToText>1 year, 3 months ago</clearspace:dateToText>
    </item>
  </channel>
</rss>

