VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
1 Replies Last post: Mar 20, 2009 10:08 AM by c_shanklin  

index out of range error with get-vmhostntpserver posted: Mar 18, 2009 7:51 PM

Click to view halr9000's profile Master 813 posts since
Jun 7, 2007
§ ATLLAPHROTTENBE {~} $a = Get-VMHost
§ ATLLAPHROTTENBE {~} $a[0] | Get-VMHostNtpServer
127.127.1.0
§ ATLLAPHROTTENBE {~} $a[1] | Get-VMHostNtpServer
Get-VMHostNtpServer : Index was outside the bounds of the array.
At line:1 char:28
+ $a[1] | Get-VMHostNtpServer <<<<
    + CategoryInfo          : NotSpecified: (:) [Get-VMHostNtpServer], IndexOutOfRangeExcep
   tion
    + FullyQualifiedErrorId : System.IndexOutOfRangeException,VMware.VimAutomation.Commands
   .Host.GetVMHostNtpServer


Add and Remove give similar errors on the same servers. I just checked server versions, looks like it's failing on my 3.0.2 servers, but works on my single 3.5 server. If this isn't supported, then you need a better error...






vExpert, PowerShell MVP, VI Toolkit forum moderator
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org

Re: index out of range error with get-vmhostntpserver

1. Mar 20, 2009 10:08 AM in response to: halr9000
Click to view c_shanklin's profile Master 754 posts since
Dec 3, 2007
Right (not supported on 3.0.2) and right (better error)

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities