Comments (7)
Update
When I set the "VMhost" InfoLevel to a value of 2 or lower, I do not hit this error and the script completes execution, successfully generating a file.
from asbuiltreport.vmware.vsphere.
It looks to be related to the Get-ESXiBootDevice
function.
Using PowerCLI connect to your vCenter Server and run the following code and let me know if you see the same error.
function Get-ESXiBootDevice {
<#
.NOTES
===========================================================================
Created by: William Lam
Organization: VMware
Blog: www.virtuallyghetto.com
Twitter: @lamw
===========================================================================
.DESCRIPTION
This function identifies how an ESXi host was booted up along with its boot
device (if applicable). This supports both local installation to Auto Deploy as
well as Boot from SAN.
.PARAMETER VMHostname
The name of an individual ESXi host managed by vCenter Server
.EXAMPLE
Get-ESXiBootDevice
.EXAMPLE
Get-ESXiBootDevice -VMHost esxi-01
#>
param(
[Parameter(Mandatory = $false)][PSObject]$VMHost
)
$results = @()
$esxcli = Get-EsxCli -V2 -VMHost $vmhost -Server $vCenter
$bootDetails = $esxcli.system.boot.device.get.Invoke()
# Check to see if ESXi booted over the network
$networkBoot = $false
if ($bootDetails.BootNIC) {
$networkBoot = $true
$bootDevice = $bootDetails.BootNIC
} elseif ($bootDetails.StatelessBootNIC) {
$networkBoot = $true
$bootDevice = $bootDetails.StatelessBootNIC
}
# If ESXi booted over network, check to see if deployment
# is Stateless, Stateless w/Caching or Stateful
if ($networkBoot) {
$option = $esxcli.system.settings.advanced.list.CreateArgs()
$option.option = "/UserVars/ImageCachedSystem"
try {
$optionValue = $esxcli.system.settings.advanced.list.Invoke($option)
} catch {
$bootType = "Stateless"
}
$bootType = $optionValue.StringValue
}
# Loop through all storage devices to identify boot device
$devices = $esxcli.storage.core.device.list.Invoke()
$foundBootDevice = $false
foreach ($device in $devices) {
if ($device.IsBootDevice -eq $true) {
$foundBootDevice = $true
if ($device.IsLocal -eq $true -and $networkBoot -and $bootType -ne "Stateful") {
$bootType = "Stateless Caching"
} elseif ($device.IsLocal -eq $true -and $networkBoot -eq $false) {
$bootType = "Local"
} elseif ($device.IsLocal -eq $false -and $networkBoot -eq $false) {
$bootType = "Remote"
}
$bootDevice = $device.Device
$bootModel = $device.Model
$bootVendor = $device.VEndor
$bootSize = $device.Size
$bootIsSAS = $device.IsSAS
$bootIsSSD = $device.IsSSD
$bootIsUSB = $device.IsUSB
}
}
# Pure Stateless (e.g. No USB or Disk for boot)
if ($networkBoot -and $foundBootDevice -eq $false) {
$bootModel = "N/A"
$bootVendor = "N/A"
$bootSize = "N/A"
$bootIsSAS = "N/A"
$bootIsSSD = "N/A"
$bootIsUSB = "N/A"
}
$tmp = [PSCustomObject]@{
Host = $vmhost.Name;
Device = $bootDevice;
BootType = $bootType;
Vendor = $bootVendor;
Model = $bootModel;
SizeMB = $bootSize;
IsSAS = $bootIsSAS;
IsSSD = $bootIsSSD;
IsUSB = $bootIsUSB;
}
$results += $tmp
$results
}
Get-ESXiBootDevice -VMHost <vmhostname>
from asbuiltreport.vmware.vsphere.
TIm,
Thanks for the quick response. I've attached a screenshot. It looks to be failing pretty quickly. I am connected to my vCenter. FYI these hosts are auto-deployed.
from asbuiltreport.vmware.vsphere.
Before running the function, can you enter:
$vCenter = “vcenter.domain.com”
Where vCenter.domain.com is the name of your vCenter server that you used in the connect-VIServer cmdlets? After that retry running the Get-ESXiBootDevice function and let us know the output please!
Cheers, Matt.
from asbuiltreport.vmware.vsphere.
Ok that worked. Most of my hosts are auto-deploy but I have a couple static. I ran against both.
from asbuiltreport.vmware.vsphere.
Hey @thecavediver,
Can you run this function against the host in your environment it was running against when the main script errored and share what the behaviour / output is?
It is getting to a particular host and trying to insert a value of "N/A" (string) in to a variable that is set as an integer.
Cheers, Matt.
from asbuiltreport.vmware.vsphere.
@thecavediver any update with this? did you identify the host which was having the issue?
from asbuiltreport.vmware.vsphere.
Related Issues (20)
- SDRS VM Overrides shows empty "Virtual Machine" column while Cluster filtering is used
- Record the TPM State of each node and if encryption enabled, backup the keys of each node into the report HOT 4
- vCenter user privileges doesn't handle groups
- Exception calling "Substring" with "1" argument(s) HOT 6
- The underlying connection was closed: A connection that was expected to be kept alive was closed by the server HOT 2
- Issues with reporting of PCI Devices with VMware ESXi 8.0 hosts HOT 1
- Issues with reporting of vCenter Server Alarms in vSphere 8.0
- Missing vSAN information when running against vSphere 8.0 environment HOT 1
- IP address Report HOT 1
- Error in Image Profile section HOT 2
- Asbuilt for vSphere errors stops running HOT 2
- vSphere 8.0 U1c Build 22088981 - New-AsBuiltReport : Cannot bind argument to parameter 'Rows' because it is an empty collection. HOT 29
- vSAN 8 ESA - "VsanDiskGroup" is empty HOT 10
- Cannot Bind Argument to Parameter "Rows" because its is empty collection following PCI devices. HOT 1
- vSphere 8.0.2-22617221 - New-AsBuiltReport : Cannot bind argument to parameter 'Rows' because it is an empty collection. HOT 8
- Host Network Section - NSX-T virtual switch portgroup labels are erroneously associated with a VMKernel port HOT 2
- New-AsBuiltReport : Cannot bind argument to parameter 'Rows' because it is an empty collection. HOT 2
- option to remove "roles" from report
- Machine SSL certificate information not working using the vcenter IP address as -Target
- SDRS VM Overrides display duplicate VMs if the vCenter is connected by IP and FQDN
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asbuiltreport.vmware.vsphere.