allencrawford
Enthusiast
Enthusiast

PowerCLI 4.1.1 issue

Jump to solution

I know I'm not the only one that has seen this warning message, but it is definitely new to PowerCLI 4.1.1. Upon connecting to a vCenter server (I've tried 4.0 U1 and 4.1 vCenter Servers) I get the following warning message after the typical SSL warnings:

WARNING: Index was outside the bounds of the array.

I noticed that over at http://communities.vmware.com/message/1656968#1656968 RvdNieuwendijk was complaining of the same issue.

Things seem to work OK, but I'm curious to know what the issue is.

0 Kudos
1 Solution

Accepted Solutions
andrey_anastaso
Enthusiast
Enthusiast

Hi folks,

Indeed, this is a bug in Connect-VIServer.

On the positive side, the bug has only cosmetic impact on existing scripts (a warning is reported). Higher impact is limited to the new “–Menu” parameter. When this parameter is specified, the cmdlet fails.

The bug is time related and only appears in December. In result, it will completely disappear on 1st of January and will reappear on 1st of December, 2011. However we expect that by December 2011 new, better release(s) will be out and 4.1.1 will not be widely used.

Last but not least, I'd like to thank all of you who reported and researched the issue for your passion making PowerCLI better!

.

.

PS:

For the curious, the problem is in the algorithm which collects and sorts the server names you connect to. The collected data is used to display a menu of recently used servers when you specify the new Connect-VIServer –Menu parameter.

If you wish to preview the menu functionality without waiting for 1st of January, change the system date to November or January and connect to a server or two to fill the menu with options.

View solution in original post

0 Kudos
7 Replies
mattboren
Expert
Expert

Hey, @allencrawford-

About the warning that you receive upon connecting to a vCenter server -- I get the same warning message. It seems to me to be related to the new "-Menu" parameter of Connect-VIServer. Per the PowerCLI v4.1.1 change log (at http://www.vmware.com/support/developer/PowerCLI/changelog.html#PowerCLI41U1), there was an improvement in which VMware "Added the Menu parameter to Connect-VIServer for storing a list of the last visited servers".

Per the full help of Connect-VIServer, the -Menu parameter is to be used as such:

"Indicate that you want to select a connection server from a list of recently connected servers. If Menu is set to $true, the cmdlet retrieves a list of the last visited servers and enters a nested command prompt, so that you can select a server from the list."

Upon trying to use the -Menu parameter, though, I received an error about the "RecentServers.xml" file not existing (with the path to the temp dir replaced here with "<%temp%>"):

"WARNING: Could not find file <%temp%>\VMware\PowerCLI\RecentServerList.xml"

Yes, that file surely did not exist. Nor did the "VMware" or "PowerCLI" subfolders. So, I made those folders, and eventually an empty file "RecentServers.xml" at the given location. Then, the warning changed to:

"WARNING: Recent servers file is corrupt: <%temp%>\VMware\PowerCLI\RecentServerList.xml"

So, my guess is that the inner workings of Connect-VIServer are not checking for the existence of this XML file when using it to make an array of recent servers. Then, the cmdlet tries to access some given index of the empty array, resulting in an "index out of bounds" warning in the form of "WARNING: Index was outside the bounds of the array."

VMware -- can someone confirm/comment?

avlieshout
VMware Employee
VMware Employee

I've created a valid XML file.

I now get the following warning message:

WARNING: The recent servers list is not populated with any severs yet. Please connect to a server first to add it to the recent servers.

Even after connecting to an ESX server, the XML file doesn't get updated.

-


Arnim van Lieshout

Blogging: http://www.van-lieshout.com

Twitter: http://www.twitter.com/avlieshout

If you find this information useful, please award points for "correct" or "helpful".

Arnim van Lieshout Blogging: http://www.van-lieshout.com Twitter: http://www.twitter.com/avlieshout If you find this information useful, please award points for "correct" or "helpful".
andrey_anastaso
Enthusiast
Enthusiast

Hi folks,

Indeed, this is a bug in Connect-VIServer.

On the positive side, the bug has only cosmetic impact on existing scripts (a warning is reported). Higher impact is limited to the new “–Menu” parameter. When this parameter is specified, the cmdlet fails.

The bug is time related and only appears in December. In result, it will completely disappear on 1st of January and will reappear on 1st of December, 2011. However we expect that by December 2011 new, better release(s) will be out and 4.1.1 will not be widely used.

Last but not least, I'd like to thank all of you who reported and researched the issue for your passion making PowerCLI better!

.

.

PS:

For the curious, the problem is in the algorithm which collects and sorts the server names you connect to. The collected data is used to display a menu of recently used servers when you specify the new Connect-VIServer –Menu parameter.

If you wish to preview the menu functionality without waiting for 1st of January, change the system date to November or January and connect to a server or two to fill the menu with options.

View solution in original post

0 Kudos
avlieshout
VMware Employee
VMware Employee

Andrey,

I've played with this new -Menu feature and I want to let you know that I noticed that the most recently connected server in the menu is at the bottom of the list.

When displaying a list of recently connected servers I would expect the most recently connected server to de displayed at the top of the list.

Just my 2 cents.

-


Arnim van Lieshout

Blogging: http://www.van-lieshout.com

Twitter: http://www.twitter.com/avlieshout

If you find this information useful, please award points for "correct" or "helpful".

Arnim van Lieshout Blogging: http://www.van-lieshout.com Twitter: http://www.twitter.com/avlieshout If you find this information useful, please award points for "correct" or "helpful".
0 Kudos
andrey_anastaso
Enthusiast
Enthusiast

Hi Arnim,

Am I right to assume that you have less than 10 servers in the list?

Generally, the idea behind ordering of the list is:

- The list contains the top 10 most frequently used servers

- Once a server enters the list, it does not change its position until it leaves the list

- The overall behavior should be similar to - for example - Windows XP's list of frequently used programs (in the Start Menu).

So, if you have less than 10 items in the list and you connect to a server you've never connected before, the new server enters at the bottom which ensures that the existing list items keep their positions.

If you want to ensure that a specific server is at specific position, the XML file which stores the statistics isn't too hard to edit manually. Or you can reset the statistics by deleting the XML statistics file. If you delete the file, then connect to your most frequently used server, empty XML statistics file will be created and the server will naturally enter at position 1 and stay there.

0 Kudos
avlieshout
VMware Employee
VMware Employee

Hi Andrey,

Thank you very much for your explanation. It makes sense now, with your information.

I noticed that the number if times you connect to a specific server is kept in the xml file for each month.

In which way is that information used?

Arnim

Sent from my iPad

Arnim van Lieshout Blogging: http://www.van-lieshout.com Twitter: http://www.twitter.com/avlieshout If you find this information useful, please award points for "correct" or "helpful".
0 Kudos
andrey_anastaso
Enthusiast
Enthusiast

The menu is based on statistics for the last 12 months only. This way, if you used some server a lot in the past but you no longer use it, it will not stay in the menu forever. The breakdown by month is so that we know which piece of the statistics to drop when a new month starts.

0 Kudos