arielsanchezmora / vDocumentation

vDocumentation provides a community-created set of PowerCLI scripts that produce infrastructure documentation of vSphere environments in CSV or Excel file format.
MIT License
157 stars 49 forks source link

A parameter cannot be found that matches parameter name 'V2' #10

Closed l3mm0n closed 7 years ago

l3mm0n commented 7 years ago

Version: 1.0.4 Command:

Get-ESXInventory -esxi [hostname] -Configuration

Results: I get most of the configuration but there are some errors at the top that I think are stopping some of the information.

Gathering host list... Get-EsxCli : A parameter cannot be found that matches parameter name 'V2'. At C:\Program Files\WindowsPowerShell\Modules\vDocumentation\1.0.4\vDocumentation.psm1:316 char:49 $esxcli2 = Get-EsxCli -VMHost $esxihost -V2 CategoryInfo : InvalidArgument: (:) [Get-EsxCli], ParameterBindingException FullyQualifiedErrorId : NamedParameterNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetEsxCli You cannot call a method on a null-valued expression. At C:\Program Files\WindowsPowerShell\Modules\vDocumentation\1.0.4\vDocumentation.psm1:323 char:9 $esxiVersion = $esxcli2.system.version.get.Invoke() CategoryInfo : InvalidOperation: (:) [], RuntimeException FullyQualifiedErrorId : InvokeMethodOnNull Gathering configuration details from [hostname] [hostname] You cannot call a method on a null-valued expression. At C:\Program Files\WindowsPowerShell\Modules\vDocumentation\1.0.4\vDocumentation.psm1:398 char:13 $vmhostSoftware = $esxcli2.software.vib.list.Invoke() CategoryInfo : InvalidOperation: (:) [], RuntimeException FullyQualifiedErrorId : InvokeMethodOnNull

arielsanchezmora commented 7 years ago

Hey thanks for opening an issue! I'll ask Edgar to take a look soon - but, you know, VMworld :)

Freepeh commented 7 years ago

l3mm0n, you need to be running the latest version of powercli. The errors you are receiving indicate you either do not have the latest version OR the host(s) you are referencing are not esxi 5.0 or later or vcenter 5.0 or later, which is what is supported. vDocumentation uses the new version of Get-ESXiCLI with the -V2 parameter which your execution is complaining about. You need to update your powercli to the latest version.

NamedJason commented 7 years ago

Maybe it would be appropriate to add a

requires -modules @{ModuleName="VMware.VimAutomation.Core";ModuleVersion="6.3.0.0"}

Some quick Googling has me thinking that 6.3 is when the -v2 flag was added.

arielsanchezmora commented 7 years ago

I'll leave this one open, and I will add this to the Readme.md - hopefully l3mm0n can upgrade

l3mm0n commented 7 years ago

Yes, you're right. I had the wrong version of PowerCLI. I'm new to PowerShell Gallery and still had the old v6.0 installed. Everything looks good now, no blank spots.

arielsanchezmora commented 7 years ago

Cool, good to know! I'll add it to the FAQ

arielsanchezmora commented 7 years ago

Added to the FAQ - now closing this issue :) thanks for opening it and all the replies!