Thanks, LucD, for your replies.
I ultimately ended up with the following code to run through all hosts:
Function HostBootCheck { Get-VMHost | Sort-Object -Property Name | ForEach-Object { $vmhostname = $_.Name $esxcli = $null $esxcli = $_ | Get-EsxCli -ErrorAction SilentlyContinue If ($esxcli -ne $null) { Try { $result = $esxcli.system.boot.device.get() If ($result.BootFilesystemUUID -ne '') { $vmhostname + ' booted from disk (' + $result.BootFilesystemUUID + ')' } If ($result.BootNIC -ne '') { $vmhostname + ' booted from the network (' + $result.BootNIC + ')' } } Catch { $vmhostname + ': Boot device info unavailable' } } Else { $vmhostname + ': Server unavailable' } }
}