Hello LucD
let us know your comments
=> This is what i am getting while running the cmdlet as it is, just connecting to vcenter and not adding anything to your original cmd
PS C:\Users\txij\Downloads\Files> Get-Cluster -PipelineVariable cluster | Get-VMHost -PipelineVariable esx | ForEach-Object -Process { $esxcli = Get-EsxCli -VMHost $esx -V2 $esxcli.network.nic.list.Invoke() | ForEach-Object -Process { $esxcli.network.nic.stats.get.Invoke(@{nicname=$_.Name}) | Select @{N='Cluster';E={$cluster.Name}}, @{N='VMHost';E={$esxcli.VMHost.Name}}, NICName,PacketsReceived,PacketsSent,ReceiveCRCerrors } } | Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture
You cannot call a method on a null-valued expression.
At line:1 char:102
+ ... -Process { $esxcli = Get-EsxCli -VMHost $esx -V2 $esxcli.network.nic ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:1 char:102
+ ... -Process { $esxcli = Get-EsxCli -VMHost $esx -V2 $esxcli.network.nic ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:1 char:102
+ ... -Process { $esxcli = Get-EsxCli -VMHost $esx -V2 $esxcli.network.nic ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:1 char:102
+ ... -Process { $esxcli = Get-EsxCli -VMHost $esx -V2 $esxcli.network.nic ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
=> this is what i am getting when i use your last tweak and enter the cluster name into the cmd
PS C:\Users\txij\Downloads\Files> Get-Cluster -name XYZ -PipelineVariable cluster | Get-VMHost -PipelineVariable esx | ForEach-Object -Process { $esxcli = Get-EsxCli -VMHost $esx -V2 $esxcli.network.nic.list.Invoke() | ForEach-Object -Process { $esxcli.network.nic.stats.get.Invoke(@{nicname=$_.Name}) | Select @{N='Cluster';E={$cluster.Name}}, @{N='VMHost';E={$esxcli.VMHost.Name}}, NICName,PacketsReceived,PacketsSent,ReceiveCRCerrors } } | Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture
You cannot call a method on a null-valued expression.
At line:1 char:134
+ ... -Process { $esxcli = Get-EsxCli -VMHost $esx -V2 $esxcli.network.nic ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:1 char:134
+ ... -Process { $esxcli = Get-EsxCli -VMHost $esx -V2 $esxcli.network.nic ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:1 char:134
+ ... -Process { $esxcli = Get-EsxCli -VMHost $esx -V2 $esxcli.network.nic ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:1 char:134
+ ... -Process { $esxcli = Get-EsxCli -VMHost $esx -V2 $esxcli.network.nic ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull