ganapa2000
Hot Shot
Hot Shot

Get-VM Error after PowerCLI Upgrade

Hi,

I am unable to use get-vm command after the PowerCLI upgrade from 6.5.3 to 10.1.1

Below is the latest PowerCLI version details

Name                            Version
----                            -------
VMware.DeployAutomation         6.7.0.8250345
VMware.ImageBuilder             6.7.0.8250345
VMware.PowerCLI                 10.1.1.8827524
VMware.Vim                      6.7.0.8343295
VMware.VimAutomation.Cis.Core   10.1.0.8377811
VMware.VimAutomation.Cloud      10.0.0.7893901
VMware.VimAutomation.Common     10.1.0.8342134
VMware.VimAutomation.Core       10.1.0.8344055
VMware.VimAutomation.HA         6.5.4.7567193
VMware.VimAutomation.HorizonView7.5.0.8827468
VMware.VimAutomation.License    10.0.0.7893904
VMware.VimAutomation.Nsxt       10.1.0.8346947
VMware.VimAutomation.PCloud     10.0.0.7893924
VMware.VimAutomation.Sdk        10.1.0.8342078
VMware.VimAutomation.Srm        10.0.0.7893900
VMware.VimAutomation.Storage    10.1.0.8313015

VMware.VimAutomation.StorageUtility 1.2.0.0

VMware.VimAutomation.Vds        10.1.0.8344219
VMware.VimAutomation.Vmc        10.0.0.7893902
VMware.VimAutomation.vROps      10.0.0.7893921
VMware.VumAutomation           

6.5.1.7862888

When I execute get-vm I am getting the below error

PS E:\myreports> get-vm

get-vm : 6/19/2018 2:49:27 AM   Get-VM          Value cannot be null.

Parameter name: array

At line:1 char:1

+ get-vm

+ ~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-VM], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

similarly, If I give the VM name, it works

PS E:\myreports> get-vm VCENTER55

Name                 PowerState Num CPUs MemoryGB

----                 ---------- -------- --------

VCENTER55       PoweredOn  28       50.000

All my scripts are also failing

#Actual Script

Get-VM | Select @{N='VM Name';E={$_.Name}},

@{N="IP Address";E={@($_.guest.IPAddress[0])}},

@{N="VM_ID";E={@($_.ExtensionData.moref.value)}},

@{N="VM PowerState";E={@($_.PowerState)}},

@{N="Operating System"; E={@($_.guest.OSFullName)}},

@{N="CPU Count";E={@($_.NumCPU)}},

@{N="MemoryInGB";E={[math]::round($_.MemoryGB)}},

PS E:\myreports> .\4_POC_VM_Reporting.ps1

Name                           Port  User

----                           ----  ----

10.16.15.26                  443   admin

Get-VM : 6/19/2018 2:36:10 AM   Get-VM          Value cannot be null.

Parameter name: array

At E:\myreports\4_POC_VM_Reporting.ps1:8 char:1

+ Get-VM | Select @{N='VM Name';E={$_.Name}},

+ ~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-VM], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

0 Kudos
15 Replies
LucD
Leadership
Leadership

Did you stop/start your PowerShel/PowerCLI session?

Did you restart the station after the upgrade?

Do you get this on all stations where you installed PowerCLI 10.1.1?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ganapa2000
Hot Shot
Hot Shot

Hi LucD,

I have closed the Powershell/PowerCLI session and rebooted the VM, still the same issue.

I am getting this issue on only one vCenter, which is running 5.5. Other vCenter is having lowest version, which is working fine.

Today, I have upgraded the problematic vCenter to latest version 5.5 build 7874785 and tried, still the same issue.

But If I connect directly to VM host, I am able to get the output of get-vm command

I am not sure, why I am not able to get output from get-vm command when I connected to vcenter

0 Kudos
LucD
Leadership
Leadership

Could this be a TLS related issue?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
FranklinS
Enthusiast
Enthusiast

How would you determine a TLS issue?

0 Kudos
LucD
Leadership
Leadership

When you try a connection with a TLS version that the target doesn't know or understand.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ganapa2000
Hot Shot
Hot Shot

Hi LucD,

But how come, other commands like get-vmhost and get-datastores are working except get-vm

But If I execute get-vm <VM_name> it works but not get-vm only command

0 Kudos
LucD
Leadership
Leadership

I was discussing this issue yesterday on a Slack channel, and we seem to remember a similar issue with the same symptoms.

At that time it was a corrupt installation.

Not 100% sure that it will fix your problem, but can you eventually do a complete removal of PowerCLI?

Removing all PowerCLI related folders (note that there could be CurrentUser and AllUser folders).
And then do a fresh install of the latest PowerCLI.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
mkfm
Enthusiast
Enthusiast

Hi

just had the same issue, strangely just on 1 of 4 vCenters, the other VCs correctly returned all VMs.

After some testing i found, that a running VM clone task was interrupting the command. After the task is completed, everything works as expected.

Just did a clone in our Lab-vCenter and same error occurs while the task is running.

So check your running tasks

JohnGibson
Hot Shot
Hot Shot

I have exactly the same issue when upgrading to latest version of PowerCLI, tried on 3 windows 2012r2 servers, one never had powercli on it, same result  with get-vm against a vcenter server, not tried all 60 vcenters yet will do that shortly, but tempted to revert back to an earlier verison of powercli.

For now bypassed error by doing a get-vm *  which worked, but will have to review all our powercli scripts.

0 Kudos
LucD
Leadership
Leadership

We had a similar thread recently, and after much searching and analysing, it turned out be a "funny" VM.

With "funny" I mean a VM that is perhaps still in the VCSA DB, but doesn't exist, or only partially.

Do you have the issue always with the same vCenter, or on all vCenters?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
JohnGibson
Hot Shot
Hot Shot

Hi

Its the same vCenters out of 53 production vCenters 14 have this issue.  They are mostly 6.5 virtual applaice and some are 6.0.

Some of these are upgraded from 5.5 and some are clean new builds.

So theres no common factor here that I can spot so far.

John

0 Kudos
LucD
Leadership
Leadership

It's not clear which conditions actually are required to suffer from this issue.

I would suggest to open a SR.
And yes, PowerCLI is supported, even though GSS might try to tell you that you need a SDK Developer Support contract.

See PowerCLI Support Breakdown.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
JohnGibson
Hot Shot
Hot Shot

Cheers yep im raising SR now we know its a significant issue to us.

Yes we have SDK Developer Support so no issues either way.

Cheers

John

0 Kudos
JohnGibson
Hot Shot
Hot Shot

Hi

Just to confirm i have been told if you have any vms that are Unknown (inacessible) this will break get-vm.

After finding and removing them the get-vm command worked.

The PowerCLI 10.3 update should fix the issue which is due later this year.

Best workaround is to avoid using get-vm on its own, as you can't cotrol any host/vCenter issues occuring that cause inacessible vms so if while they should be cleared up, if you rely on some PowerCLI scripts and need to ensure  they keep working then best code around the possiblity of it happening.

John

0 Kudos
LucD
Leadership
Leadership

Thanks for sharing that info.

Still not sure what an 'Unknown' VM is, and more importantly, how to find them :smileygrin:

You can indeed avoid the issue by using

Get-VM -Name *

And if you don't want to go changing all your scripts, you can set that as a default for the Get-VM cmdlet.

Something like this (perhaps in your profile till the issue is fixed).

$PSDefaultParameterValues = @{"Get-VM:Name"='*'}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos