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
Do you have 2 VMs returning the same info? Possibly cloned VMs or something that somehow managed to get into your inventory twice?
Try this
Get-VMHost | % { Get-VM -Location $_.Name }
Hello harkamal,
I tried that command today
Get-VMHost | % {Get-VM -Location $_.Name}
However the following error at some point:
Get-VM : Value cannot be null.
Parameter name: array
However, it cycles through the hosts and keeps going after it hits that error. That would lead me to believe that there is a problem with a certain host. The strange thing is I can take the host out of vCenter and the error moves to a different host.
Regards,
Harley Stagner
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 ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
What versions of ESX and vCenter are you using? Including build number?
=====
Carter Shanklin
Read the PowerCLI Blog
[Follow me on Twitter|http://twitter.com/cshanklin]
-I am using the PowerCLI (no PowerGUI or VESI)
-I have restarted the environment between tests and restarted the vCenter service.
Carter,
-ESX is 3.5.0 Build 153875
-vCenter is 2.5.0 Build 174768
Regards,
Harley Stagner