AsBuiltReport / AsBuiltReport.VMware.vSphere

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

New-AsBuiltReport : Cannot convert value "N/A" to type "System.Int32". Error: "Input string was not in a correct #76

Closed vtrimi closed 4 years ago

vtrimi commented 4 years ago

Describe the bug A clear and concise description of what the bug is. VERBOSE: [ 19:59:33:522 ] [ Document ] - Processing section 'Hardware' started. VERBOSE: [ 19:59:33:538 ] [ Document ] - Processing paragraph 'The following section details the ho[..]'. VERBOSE: [ 19:59:33:538 ] [ Document ] - Processing blank line. VERBOSE: [ 19:59:34:572 ] [ Document ] - Processing table 'xxxx ESXi Host Detailed Information'. VERBOSE: [ 19:59:34:603 ] [ Document ] - Processing section 'Boot Device' started. New-AsBuiltReport : Cannot convert value "N/A" to type "System.Int32". Error: "Input string was not in a correct format." At line:1 char:1


The latest version 1.1.3. (AsBuiltReport) and latest PowerCLI version. Boot Device from the server "None" --> Stateless Auto Deploay

orb71 commented 4 years ago

Hi Trim,

Do you mind posting the following output from your console please ?

esxcli system boot device get esxcli system settings advanced list -o /UserVars/ImageCachedSystem esxcli storage core device list

Regards, Oli

vtrimi commented 4 years ago

Hi Oli,

Thank you for coming back to me.

Unfortunately i cant send you the core device list (more then 100LUNs). It would be amazing just to skip if something fails like the issue i had or similar and not stop the hole script.

root@xxxx:~] esxcli system boot device get Boot Filesystem UUID: Boot NIC: xx-xx-xx-xx-xx-xx-xx Stateless Boot NIC:

[root@xxxx:~] esxcli system settings advanced list -o /UserVars/ImageCachedSystem Unable to find option ImageCachedSystem

BR ./trim

orb71 commented 4 years ago

Ouch 100!

We won't need it since it happens outside the function. You need to edit Invoke-AsBuiltReport.VMware.vSphere.ps1 in your module directory

Line 372 : $bootSize = "N/A" and replace it by $bootSize = 0 for the quick and dirty fix.

The problem ia found at line 1868, we have a missing a value type check.

'Size' = Switch ($ESXiBootDevice.SizeMB){ 'N/A' { 'N/A' } default{"$([math]::Round($ESXiBootDevice.SizeMB / 1024, 2)) GB"} }

Hope it helps! Oli

vtrimi commented 4 years ago

hi Oli,

Yes, sir. this solved my issue! Thank you very much. I hope this helps as well other people who use Auto Deploy.

BR ./trim

tpcarman commented 4 years ago

Awesome work @orb71. Thank you. I've found a few other issues which I have pushed to the dev branch. Expect this fix there shortly too.

orb71 commented 4 years ago

@tpcarman , glad to help and I don't mind submiting pull request. Do you want me to submit a bug report for the Get-PCIDeviceDetail function as well?