WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Identifying ESXi boot method & boot device

Identifying ESXi boot method & boot device

01.09.2018 by William Lam // 13 Comments

There was an interesting discussion on our internal Socialcast platform last week on figuring out how an ESXi host is booted up whether it is from local device like a disk or USB device, Auto Deploy or even boot from SAN along with its respective boot device? Although I had answered the question, I was not confident that we actually had a reliable and programmatic method for identifying all the different ESXi boot methods, which of course piqued my interest.

With a bit of trial and error in the lab, I believe I have found a method in which we can identify the ESXi boot type (Local, Stateless, Stateless Caching, Stateful or Boot from SAN) along with some additional details pertaining to the boot device. To demonstrate this, I have created the following PowerCLI script ESXiBootDevice.ps1 which contains a function called Get-ESXiBootDevice.

The function can be called without any parameters, in which it will query all ESXi hosts for a given vCenter Server and/or standalone ESXi host. You can also specify a specific ESXi host by simply passing in the -VMHostname option.

Here is an example output for one of my lab environments which shows several ESXi hosts and their different boot methods from local disk to Auto Deploy which can include stateless, stateless caching and stateful deployments. Depending on the BootType, the boot device shown in the Device column will either be the MAC Address of the NIC used to network boot the ESXi host or the identifier of a disk device. I have also included some additional details such as vendor/model along with the media type (SAS, SSD or USB) which is available as part of ESXCLI.


This script also supports ESXi environments that boot from SAN (FC, FCoE or iSCSI) and you can easily identify that with the word "remote" for the BootType. I would like to give a huge thanks to David Stamen who helped me out with the boot from SAN testing.

More from my site

  • How do you "log a reason" using PowerCLI when rebooting or shutting down ESXi host?
  • Quick Tip - How to retrieve the ESXi Update Level using the vSphere API?
  • Using the vSphere API to remotely collect ESXi esxcfg-info
  • Customizing the ESXi DCUI to show number of VMs
  • Retrieving vCenter Server certificate (Machine, VMCA Root, STS & Trusted Root) details using the vSphere API 

Categories // Automation, ESXi, PowerCLI, vSphere Tags // /UserVars/ImageCachedSystem, auto deploy, boot from SAN, ESXi, PowerCLI, stateful, stateless, stateless caching, vSphere API

Comments

  1. *protectedAnanda Kammampati says

    01/09/2018 at 11:57 am

    Thanks for sharing.

    I am guessing an USB boot would then be "BootType = Local" and "IsUSB=true"

    Reply
    • William Lam says

      01/09/2018 at 1:20 pm

      Yes, that's correct

      Reply
    • *protectedShivakumar Sreedharan says

      05/20/2020 at 12:28 am

      Yeah..that is how i used to find it.....

      Reply
  2. *protectedRoman Gelman says

    01/22/2018 at 10:35 pm

    Hi William, great idea, BUT:
    The `$esxcli.storage.core.device.list.Invoke()` doesn't return `IsBootDevice` property for pre vSphere6.x hosts :-(.
    As well as `IsSAS` and many others, 49 properties in vSphere 6.0 vs 33 in vSphere 5.5.

    Reply
  3. *protectedNicholas Sousa says

    02/07/2018 at 8:46 am

    You may want to look into ValidateScript for checking your input parameters.

    Reply
  4. *protectedaj mun says

    04/10/2018 at 7:19 am

    I too get the following error:

    You cannot call a method on a null-valued expression.
    At C:\admin\00_SETTINGS\_PROFILES\vmware powercli\ESXiBootDevice.ps1:60 char:9
    + $devices = $esxcli.storage.core.device.list.Invoke()
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    I'm running powercli version:

    PowerCLI C:\> Get-PowerCLIVersion

    PowerCLI Version
    ----------------
    VMware PowerCLI 6.5 Release 1 build 4624819
    ---------------
    Component Versions
    ---------------
    VMware Cis Core PowerCLI Component 6.5 build 4624453
    VMware VimAutomation Core PowerCLI Component 6.5 build 4624450
    VMWare ImageBuilder PowerCLI Component 6.5 build 4561891
    VMWare AutoDeploy PowerCLI Component 6.5 build 4561891
    VMware Vds PowerCLI Component 6.5 build 4624695
    VMware Cloud PowerCLI Component 6.5 build 4624821
    VMware HA PowerCLI Component 6.0 build 4525225
    VMware HorizonView PowerCLI Component 7.0.2 build 4596620
    VMware Licensing PowerCLI Component 6.5 build 4624822
    VMware PCloud PowerCLI Component 6.5 build 4624825
    VMware Storage PowerCLI Component 6.5 build 4624820
    VMware vROps PowerCLI Component 6.5 build 4624824
    VMware vSphere Update Manager PowerCLI 6.5 build 4540462

    Reply
  5. *protectedaj mun says

    04/10/2018 at 8:50 am

    BTW, changing get-esxcli from -V2 to V1 (by removing the -V2 from the script), provides a completely different output on some hosts. See below to understand what I'm talking about but I've confirmed invidually no the esxi hosts that the v1 form of the script is accurate and somehow v2 is outputing incorrect information:

    The esxi hosts below in my environment are the following version:

    VMware ESXi 6.0.0 build-3380124
    VMware ESXi 6.0.0 Update 1

    And yes I know something will be mentioned about me using PowerCLI 6.5 update 1 possibly being the cause but just wanted to point it out....

    Host Device BootType Vendor Model SizeMB IsSAS IsSSD IsUSB
    ---- ------ -------- ------ ----- ------ ----- ----- -----
    (using get-esxcli v2 in script)
    examplecomputer02.domain.example mpx.vmhba32:C0:T0:L0 local HP 8GB_EM_USB_Drive 7648 false false true
    examplecomputer41.domain.example mpx.vmhba32:C0:T0:L0 local HP 8GB_EM_USB_Drive 7648 false false true
    examplecomputer42.domain.example mpx.vmhba32:C0:T0:L0 local HP 8GB_EM_USB_Drive 7648 false false true
    examplecomputer43.domain.example mpx.vmhba32:C0:T0:L0 local HP 8GB_EM_USB_Drive 7648 false false true

    using get-esxcli v1 in script)
    examplecomputer02.domain.example naa.600508b1001ce9555e76817a3a6cd886 remote HP LOGICAL VOLUME 858451 true false false
    examplecomputer41.domain.example naa.600508b1001ce9555e76817a3a6cd886 remote HP LOGICAL VOLUME 858451 true false false
    examplecomputer42.domain.example naa.600508b1001ce9555e76817a3a6cd886 remote HP LOGICAL VOLUME 858451 true false false
    examplecomputer43.domain.example naa.600508b1001ce9555e76817a3a6cd886 remote HP LOGICAL VOLUME 858451 true false false

    Reply
  6. *protectedguru says

    01/08/2019 at 7:28 pm

    This script does not seem to be working. Can someone confirm if it has worked for them recently ?

    Reply
  7. *protectedShaz says

    02/18/2019 at 8:39 pm

    Running on 6.5 U2 hosts - no output - no error

    Reply
  8. *protectedDouglas Ferguson says

    11/18/2021 at 7:29 am

    Thanks! This is exactly what I am needing for vSphere ESXi 7.0 upgrades. Since the new partition layouts and storage requirements affect our ability to deploy supportable upgrades, this will help us identify hosts we shouldn't be upgrading since that logic seems to be missing from LCM.

    One thing I would like to add is to insert a clause so that the script won't try to invoke Get-ESXCli against disconnected, or NotResponding hosts:
    if ($VMHost.ConnectionState -in 'Connected', 'Maintenance') {
    #do your collection stuff and add the pscustomobject to the $Results variable
    }
    I also changed my "copy" to use [System.Collections.ArrayList]@() instead of the basic @() array since it is more efficient - $null = $Result.Add($tmp) doesn't re-write the entire $Result array object like $Result += $tmp does.

    Reply
    • *protectedRobert says

      02/08/2022 at 6:34 am

      @douglas Can you post your copy here.. I would also like to exclude not responding hosts.

      Reply
  9. *protectedMourad REBAI says

    01/15/2025 at 8:52 am

    You may try :
    PS C:\> (Get-VMHost | Get-EsxCli).storage.core.device.list()|where {$_.IsBootDevice -eq $True}|select Device, Vendor, IsUSB, IsRemovable, Size

    Device : mpx.vmhba32:C0:T0:L0
    Vendor : SanDisk
    IsUSB : true
    IsRemovable : true
    Size : 14944

    PS C:\>

    Reply
  10. *protectedMourad REBAI says

    01/15/2025 at 9:01 am

    Sorry mistaping, the vmhost name(s) are required :

    (Get-VMHost | Get-EsxCli).storage.core.device.list()|where {$_.IsBootDevice -eq $True}|select Device, Vendor, IsUSB, IsRemovable, Size

    (Get-VMHost -name * | Get-EsxCli).storage.core.device.list()|where {$_.IsBootDevice -eq $True}|select Device, Vendor, IsUSB, IsRemovable, Size

    Reply

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...