VMware

This Question is Not Answered

1 "correct" answer available (10 pts) 1 "helpful" answer available (6 pts)
6 Replies Last post: Sep 18, 2009 8:06 AM by hstagner  

Strange PowerCLI Problem with Get-VM posted: Sep 15, 2009 1:00 PM

Click to view hstagner's profile Hot Shot 135 posts since
Oct 16, 2008

I am having a really strange problem with PowerCLI on a certain vCenter. Any help would be appreciated.

Background:

-On a certain vCenter when I issue the command get-vm I get the following error message:

Get-VM : Object reference not set to an instance of an object.

-Get-VM
gets all the VM objects that vCenter can see and returns an array
populated with the objects. The .NET error that I am getting is saying
that an array cannot be populated with a null object. It cannot get all
the VM's for some reason.

-This can be confirmed by issuing the following command instead:

Get-VMHost <ESX HostName> | get-vm

-This
gets all the VM's from a particular host. That works except for on one
particular host at the moment. When I run the command on the host in
question I get the following error:

Get-VM : Value cannot be null.
Parameter name: array

-So
this should point to a problem with that host. However, if I move all
of the VM's off of that host and try each host individually again, I
will eventually run into the same error:

Get-VM : Value cannot be null.
Parameter name: array

That
tells me that the problem could be following a certain VM (perhaps
permissions where a certain VM's properties cannot be read, etc.). However, If I move the VM's off of the Host one by one and keep testing the host, the problem is not resolved.

Strange, right? Does anyone have any ideas on how to move forward with troubleshooting this? Thank you.

Regards,

Harley Stagner

Re: Strange PowerCLI Problem with Get-VM

1. Sep 15, 2009 2:17 PM in response to: hstagner
Click to view bulletprooffool's profile Master 838 posts since
Apr 14, 2009
Do you have 2 VMs returning the same info? Possibly cloned VMs or something that somehow managed to get into your inventory twice?

Re: Strange PowerCLI Problem with Get-VM

2. Sep 15, 2009 8:01 PM in response to: hstagner
Click to view harkamal's profile Hot Shot 251 posts since
Mar 19, 2009

Try this

Get-VMHost | % { Get-VM -Location $_.Name }

Re: Strange PowerCLI Problem with Get-VM

4. Sep 17, 2009 1:29 PM in response to: hstagner
Click to view LucD's profile Champion vExpert 3,063 posts since
Oct 31, 2005
From which environment are you running the command ? (PowerCLI prompt, PowerGui, EcoSHell...)
Did you stop/start your environment between those tests ?

Did you try stopping/starting the VC service ?

Re: Strange PowerCLI Problem with Get-VM

5. Sep 17, 2009 1:59 PM in response to: hstagner
Click to view c_shanklin's profile Master VMware Employees 855 posts since
Dec 3, 2007
What versions of ESX and vCenter are you using? Including build number?

=====
Carter Shanklin
Read the PowerCLI Blog
Follow me on Twitter

VMware Beta Programs

Want to be Considered for Future Beta Programs?

Learn More

VMware Developer

Download SDKs, APIs, videos,
training, and 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

Only VMware ... Delivers Nexus 1000V

Ensure consistent, policy-based network capabilities to virtual machines across your data center.

Learn More

Communities