AsBuiltReport / AsBuiltReport.VMware.vSphere

Repository for AsBuiltReport VMware vSphere module
https://www.asbuiltreport.com
MIT License
112 stars 39 forks source link

vSphere 8.0 U1c Build 22088981 - New-AsBuiltReport : Cannot bind argument to parameter 'Rows' because it is an empty collection. #111

Closed Tony-SouthFLVMUG closed 11 months ago

Tony-SouthFLVMUG commented 1 year ago

Describe the bug vSphere 8.0 U1c Build 22088981 - New-AsBuiltReport : Cannot bind argument to parameter 'Rows' because it is an empty collection.

To Reproduce Steps to reproduce the behavior:

  1. Upgrade VCSA to 8.0 U1c
  2. Run AsBuiltReport

System (please provide the following information about the system from which you are trying to generate a report):

ollie2001 commented 1 year ago

Hi, I enabled the verbose option and it seems to fall over at the gathering PCI devices stage. So I binned that section out of the Invoke-AsBuiltReport.VMware.vSphere.ps1 file and rebooted, worked fine after that. Hopefully the devs can sort that section out :)

michern1102 commented 1 year ago

Hi, I enabled the verbose option and it seems to fall over at the gathering PCI devices stage. So I binned that section out of the Invoke-AsBuiltReport.VMware.vSphere.ps1 file and rebooted, worked fine after that. Hopefully the devs can sort that section out :)

Hey Ollie,

Can you show what portions of the Invoke-AsBuiltReport.VMware.vSphere.ps1 you removed? I also went an commented out both PCI portions as well as rebooted the machine and when checking verbose it keeps saying that its processing the PCI portion. It doesn't make sense because I fully removed the PCI portion. I searched the whole script for anything pertaining to "PCI" and found nothing that hasn't been commented out. The only thing I can think of is that I'm not editing the right file?

Wursti1 commented 1 year ago

I have the same issue. Had it with 8.0, which was fixed and now I have the same with 8u1c. I need the VMHost Information so it would be great if there is a fix.

ollie2001 commented 1 year ago

Hi guys, I actually deleted out the entire section instead of commenting it out.

and I had to reboot the workstation I was running the script from as it seemed to cache the original file. Took a while to work that out!

Good luck!

vArNi0101 commented 1 year ago

We are facing the same issue right now with vCenter running 8.0.1.00300.

New-AsBuiltReport: Cannot bind argument to parameter 'Rows' because it is an empty collection.
At line:1 char:1
New-AsBuiItReport -Report VMware.vSphere -Target _vCenter_
+ CategoryInfo: NotSpecified: (:) [Write-Error],WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShe1.Commands.WriteErrorException,New-AsBuiltReport

So is there any workaround? May upgrading to 8.0.2.00000 would help?

tpcarman commented 1 year ago

The issue is with ESXCLI and affects all versions of ESXi 8.x. Somehow they revoked the reporting of the VMkernel name from the ESXCLI hardware pci list in ESX 8.x. If someone is willing to log a support request then VMware may fix it. I can provide a workaround to skip the reporting of the PCI devices for 8.x however I'd prefer VMware fix the issue. Unfortunately I don't have any way to log support requests, so if you are able to log it, I can share more info and would be grateful.

michern1102 commented 1 year ago

Hi guys, I actually deleted out the entire section instead of commenting it out.

and I had to reboot the workstation I was running the script from as it seemed to cache the original file. Took a while to work that out!

Good luck!

Thanks for the reply!

I unfortunately can only work on a non-persistent VDI session for this issue so when I reboot I need to reinstall from PSGallery. Always more fun....

The issue is with ESXCLI and affects all versions of ESXi 8.x. Somehow they revoked the reporting of the VMkernel name from the ESXCLI hardware pci list in ESX 8.x. If someone is willing to log a support request then VMware may fix it. I can provide a workaround to skip the reporting of the PCI devices for 8.x however I'd prefer VMware fix the issue. Unfortunately I don't have any way to log support requests, so if you are able to log it, I can share more info and would be grateful.

If you have a work around that might work I'm all ears!

MattRNZ commented 1 year ago

I can confirm it's still broken with ESXi 8u2. I've logged a ticket with vmware - Support Request # 23467388509

tpcarman commented 1 year ago

Thanks @MattRNZ.

Output from esxcli hardware pci list below.

Similiar results will be seen when using PowerCLI and Get-ESXCLI -V2 <hostname> hence the issue with the AsBuiltReport module.

image

image

MattRNZ commented 1 year ago

VMware closed my ticket as apparently I logged it to the wrong team. It needs to be logged with the SDK&API support team, and I don't have access to that. Have you tried reaching out on reddit's r/vmware? Several VMware employees are there and may be able to help.

mpacholke commented 1 year ago

Update to 8.0.2.00000 does not help vDocumentaion , Get-ESXIODevice does not work too.

tpcarman commented 1 year ago

vDocumentaion , Get-ESXIODevice does not work too.

Yep, this is where the original code came from.

tpcarman commented 1 year ago

Have you tried reaching out on reddit's r/vmware? Several VMware employees are there and may be able to help.

I've posted it to the vExpert Slack channel and will see if we can get any further assistance.

tpcarman commented 1 year ago

I can provide a workaround to skip the reporting of the PCI devices for 8.x

I am currently implementing a workaround which will prevent the script from terminating however it does not resolve the issue of the report of PCI devices on ESXi 8.x hosts.

mpacholke commented 1 year ago

'esxcli hardware pci list' works

Vendor Name: VMware Inc. Device Name: vmxnet3 Virtual Ethernet Controller Configured Owner: VMkernel Current Owner: VMkernel Vendor ID: 0x15ad Device ID: 0x07b0 SubVendor ID: 0x15ad SubDevice ID: 0x07b0 Device Class: 0x0200 Device Class Name: Ethernet controller

the problem is how to inject this vis powerwshell

lamw commented 1 year ago

Because ESXCLI is just a CLI utility, it is NOT an API, it may not always provide backwards compatibility in terms of the field.

Since this is simply listing PCI devices ... the output is what I'd expect. If you wanted to get the association, I would look at using other parts of the vSphere API to get this info. In fact, I suspect this might even be a behavior change with lspci because typically, you'll see "logical" devices (e.g. vmnicX) labeled next to PCIe device but looking at physical 8.0U2 host, I don't see that anymore, so its possible these fields aren't in lspci which is how ESXCLI is retrieving this info ...

If you really want the mapping between PCIe devices/NIC, you should be using something like:

 esxcli network nic list
Name    PCI Device    Driver  Admin Status  Link Status  Speed  Duplex  MAC Address         MTU  Description
------  ------------  ------  ------------  -----------  -----  ------  -----------------  ----  -----------
vmnic0  0000:05:00.0  igbn    Up            Up            1000  Full    ac:1f:6b:1a:4e:fa  1600  Intel Corporation I350 Gigabit Network Connection
vmnic1  0000:05:00.1  igbn    Up            Up            1000  Full    ac:1f:6b:1a:4e:fb  1600  Intel Corporation I350 Gigabit Network Connection
vmnic2  0000:03:00.0  ixgben  Up            Down             0  Half    ac:1f:6b:1a:4f:c8  1500  Intel(R) Ethernet Connection X552/X557-AT 10GBASE-T
vmnic3  0000:03:00.1  ixgben  Up            Up           10000  Full    ac:1f:6b:1a:4f:c9  9000  Intel(R) Ethernet Connection X552/X557-AT 10GBASE-T
mpacholke commented 1 year ago

In my case i need the vendor id's in order to validate the drivers with the vmware HCL. Until now i used the Get-ESXIODevice of vDocumentation. Running esxcli on each hosts works but is very unhandy. I would like to know if this is an issue or planed/expected.

lamw commented 1 year ago

Get-ESXIODevice isn't an actual VMware cmdlet, so you need to talk to vDocumentation folks and see how thats been implemented and either have them adjust OR simply grab the required detail yourself via vSphere API.

ESXCLI can be proxy through vCenter Server, so you're not "going to each host" and to get host level details, you'll need to go to each host reference anyhow, so you're still needing to do same thing. This isn't an ESXCLI issue as I mentioned, the CLI does NOT ensure backwards/forwards compatibility of fields unlike a vSphere API which DOES have strong backwards compat

mpacholke commented 1 year ago

I think the project is not continued anymore. i hoped to use asbuilt as a substitute.

lamw commented 1 year ago

My suggestion is to take a look at their function and replicate that in your code, this way you understand how it actually works and you can probably even improve on the implementation ... since PCI info is available via vSphere API and using ESXCLI isn't most efficient method

mpacholke commented 1 year ago

This sounds like the end solution will take some time. Perhaps a workaround which skips the pci information would be a first step. @Tim: Di you have an idea when the workaround will be released?

I commented out the regions to execute the script without errors: region ESXi Host PCI Devices region ESXi Host PCI Devices Drivers & Firmware

orb71 commented 1 year ago

My suggestion is to take a look at their function and replicate that in your code, this way you understand how it actually works and you can probably even improve on the implementation ... since PCI info is available via vSphere API and using ESXCLI isn't most efficient method.

@lamw , This operation is now performed using the vSphere API, but I'm uncertain about the GPU aspect. The information I found to achieve a similar result dates back to API 5.5. As of version 13.1, there is no PowerCLI cmdlet available.

lamw commented 1 year ago

@orb71 Can you point me to the code or what you're looking for exactly

lamw commented 1 year ago

Yes, that can be used for known graphics https://vdc-repo.vmware.com/vmwb-repository/dcr-public/184bb3ba-6fa8-4574-a767-d0c96e2a38f4/ba9422ef-405c-47dd-8553-e11b619185b2/SDK/vsphere-ws/docs/ReferenceGuide/vim.host.GraphicsInfo.html or you can simply enumerate the PCI devices https://vdc-repo.vmware.com/vmwb-repository/dcr-public/184bb3ba-6fa8-4574-a767-d0c96e2a38f4/ba9422ef-405c-47dd-8553-e11b619185b2/SDK/vsphere-ws/docs/ReferenceGuide/vim.host.PciDevice.html in case this property isn't populated and possibly for consumer systems. You'll have to do some tests ...

orb71 commented 1 year ago

The whole code is found here #112 I retrieved with VMHostHBA and VMHostNetAdapter only PCI Address and Device Name. Next, I match them to VMHostPCIDevice to create the object.

I've discovered this Data Object: HostGraphicsInfo $GpuAdapters = (Get-VMHost $VMhost | Get-View -Property Config).Config.GraphicsInfo

I don't have a server with a GPU, and the onboard server video doesn't provide any information. Technology has evolved significantly since version 5.5, which is why I am curious.

lamw commented 1 year ago

I'm afraid, you'll need to do some testing to see what it returns and I think for iGPU, it may not return there. At the end of the day, if the data is null/empty, you can just ignore :)

rebelinux commented 11 months ago

The whole code is found here #112 I retrieved with VMHostHBA and VMHostNetAdapter only PCI Address and Device Name. Next, I match them to VMHostPCIDevice to create the object.

I've discovered this Data Object: HostGraphicsInfo $GpuAdapters = (Get-VMHost $VMhost | Get-View -Property Config).Config.GraphicsInfo

I don't have a server with a GPU, and the onboard server video doesn't provide any information. Technology has evolved significantly since version 5.5, which is why I am curious.

It works in my setup!

PS /home/rebelinux> (Get-VMHost $VMHost | Get-View -Property Config).Config.GraphicsInfo 

DeviceName     : GM206 [GeForce GTX 960]
VendorName     : NVIDIA Corporation
PciId          : 0000:02:00.0
GraphicsType   : shared
MemorySizeInKB : 0
Vm             : 
LinkedView     : 

PS /home/rebelinux> 

Screenshot from 2023-11-11 18-07-04

orb71 commented 11 months ago

Thank you for the confirmation! I noticed that the devices are not sorted, even though the code was supposed to make the list very sequential.

rebelinux commented 11 months ago

I added Sort-Object 'Device' to the code and now the table is sorted.

$VMHostPciDevices | Sort-Object 'Device' | Table @TableParams

Screenshot from 2023-11-12 16-07-06