June 9, 2016

Scripted Boot to Windows PE using HP iLO PowerShell Cmdlets

This blog post documents the HP iLO PowerShell commands I used for scripting the process of booting to Windows PE for purposes such as using Microsoft SCCM (System Center Configuration Manager) and/or SCO (System Center Orchestrator) runbooks for automated operating system deployment.

Thanks to Kyle Murley's blog post which led me to this.



  • HP iLO Cmdlets for Windows PowerShell (x86/x64) - (v1.3 as of this moment).
  • HP iLO Server with Advanced iLO License. (Already required by the first Mount-HPiLOVirtualMedia command) - This post is based on iLO4, but it might also work for iLO3 or others. Kindly let me know if it does for you.
  • Web server (e.g. Microsoft IIS) for hosting the Windows PE ISO file (as required by ImageURL parameter).
  • [Optional] Sysinternals Process Monitor for monitoring the download of Windows PE ISO file from the web server.
  • [Optional] HP Scripting Tools for Windows PowerShell User Guide (Also, I found the built-in command help is very useful, e.g. Get-Help Set-HPiLOVMStatus -full)

Not Covered by This Post

As the focus is on HP iLO Cmdlets, this post won't cover the below:

  • Embedding drivers into a Windows PE image.
  • Converting a boot.WIM Windows PE image to .ISO format (without "Press any key to boot from..." message). However, reference URLs are included at the bottom of this post.
  • Hosting a Windows PE ISO image on a web server for iLO to serve.

The Script (UEFI)

Web Server Recommendations

  • As the Windows PE ISO is quite large (the x64 version is about 250MB) for transferring over a WAN connection, it is recommended to use a web server which resides on the same site link as the iLO server does.
  • To increase security, consider use of HTTP over SSL (HTTPS) and/or non-common port.
  • To avoid complexity during initial testing, IP address is recommended instead of hostname/FQDN.

# Version: 1.0
# Last Update: 20 Oct 2015
# iLO Cmdlet Version (at the time): 1.2
# Author: wandersick (

$iloIP = "HP_iLO_IP_addr"
$isoUrl ="http://web_srv_IP_addr/winpe.iso"

# Mount Windows PE iso
Mount-HPiLOVirtualMedia -Server $iloIP -user $iloUserName -pass $iloPassword -Device CDROM -ImageURL $isoUrl

# Connect the virtual media on next boot (change BOOT_ONCE to CONNECT to connect the media now and leave it mounted even after the next boot)

Set-HPiLOVMStatus -Server $iloIP -user $iloUserName -pass $iloPassword -Device CDROM -VMBootOption BOOT_ONCE

# Verify the above commands by PowerShell (This is equivalent to shell command "vm cdrom get")
# Get-HPiLOVMStatus -Server $iloIP -user $iloUserName -pass $iloPassword -Device CDROM
# Where BOOT_OPTION: BOOT_ONCE and IMAGE_URL: http://....iso

# As boot order cannot be modified during POST, instead of setting boot order and reboot the server with ‘Reset’ (i.e. Reset-HPiLOServer -Server $iloIP -user $iloUserName -pass $iloPassword), this script attempts to perform a power-off of the HOLD type, set boot order and then power it back on to continue booting.

# Power OFF the server (Force)

Set-HPiLOVirtualPowerButton -Server $iloIP -user $iloUserName -pass $iloPassword -PressType HOLD

# UEFI - Boot from ISO URL on next boot (This is not the preferred method. See Persistent Boot method below.)

# BootCustom = UEFI Target

# Boot0008 = Generic USB Device (iLO attempts booting from all possible USB devices)
# Set-HPiLOOneTimeBootOrder -Server $iloIP -user $iloUserName -pass $iloPassword -Device BootCustom -BootCustomName Boot0008

# UEFI - Persistent Boot (Preferred)

Set-HPiLOPersistentBootOrder -Server $iloIP -user $iloUserName -pass $iloPassword -BootOrder Boot0008

# Power ON the server

Set-HPiLOHostPower -Server $iloIP -user $iloUserName -pass $iloPassword -HostPower "Yes"

Additional Information

  • I noticed our new HP servers come with Generic USB Device as the first boot option by default. However, it is nice to specify it to ensure it is by the above command.
  • For UEFI, booting to Generic USB Device (Boot0008) is preferred to iLO Virtual USB CDROM (Boot000D) as the latter is not selectable after mounting the ISO with Mount-HPiLOVirtualMedia until a subsequent reboot past POST.
  • Persistent boot order is preferred to one-time boot order as the PowerShell results are more consistent. See below sections for further explanations on this.

The Script (Legacy BIOS)

There are two variants of the script. One is based on UEFI boot mode, while the other is based on Legacy BIOS. The above script is for UEFI; for Legacy BIOS, simply change lines beginning with UEFI to these

# Legacy BIOS - Boot from ISO URL on next boot (This is not the preferred method. See Persistent Boot method below.)

Set-HPiLOOneTimeBootOrder -Server $iloIP -user $iloUserName -pass $iloPassword -Device CDROM

# Legacy BIOS - Persistent Boot (Preferred)

Set-HPiLOPersistentBootOrder -Server $iloIP -user $iloUserName -pass $iloPassword -BootOrder CDROM

Running the Script

Note: The screenshot below is based on a previous version of the script.

Running the PowerShell commands in one go.


The server would then be rebooted.


When the Windows logo is shown, the ISO image is being transferred. When it has finished the transfer, a spinning circle would be shown under the logo indicating it is loading the Windows PE OS.


We can track the download of Windows PE ISO using netstat and Sysinternals Process Monitor as follows.


  • netstat -n 2 | find /i "HP_iLO_IP_addr"

Process Monitor

  • Filter set to: "Path", "Contains", "your_winpe_filename.iso"


The Windows PE is successfully booted up.


Tips and Tricks

The PowerShell command Get-HPiLOPersistenBootOrder below reveals the boot code of each UEFI target in one go

  • Get-HPiLOPersistentBootOrder -Server $iloIP -user $iloUserName -pass $iloPassword | select -ExpandProperty device

Each of them corresponds to the item in the boot order list on iLO web interface, e.g. the first code Boot000D is "iLO Virtual USB 2 : HP iLO Virtual USB CD/DVD ROM" while the third code Boot0008 is "Generic USB Boot".Image(5)

Alternatively, on the boot menu screen (F11) shown during POST, pressing F1 (Help) on each item also reveals the boot item code.


Boot0008 (Generic USB Boot) is recommended over Boot000D (iLO Virtual USB 2 : HP iLO Virtual USB CD/DVD ROM) as the latter is dynamic. It only appears after specifying mounting of the ISO, rebooting the server and getting past POST. When it does not appear, it would return "ERROR: No UEFI Target boot device with the specified BootXXXX name is available."


Persistent boot order is preferred to one-time boot order as the PowerShell results are more consistent. Setting one-time boot order via PowerShell may generate “There is no such EV.” error while host is powered off; setting it via web interface is OK though. Perhaps you might wonder whether it will boot to the ISO every time the server boots? Fortunately no, because we make use of the BOOT_ONCE option of Set-HPiLOVMStatus command to achieve one-time boot (which has nothing to do with boot order). This option mounts the ISO on next boot only and dismounts it automatically on subsequent boots. The VM in the command stands for Virtual Media which corresponds to the below part of the iLO web interface.

As shown, the "Connected" checkbox is only checked on next boot. It is automatically unchecked after subsequent reboots.


Verify the effect of Mount-HPiLOVirtualMedia and Set-HPiLOVMStatus commands using Get-HPiLOVMStatus

  • Get-HPiLOVMStatus -Server $iloIP -user $iloUserName -pass $iloPassword -Device CDROM

Where BOOT_OPTION of -VMBootOption parameter of Set-HPiLOVMStatus can be one of the below:

  • BOOT_ONCE (This should be the case if -VMBootOption is BOOT_ONCE which is option used above in the script.)
  • BOOT_ALWAYS (This should be the case -VMBootOption is CONNECT)
  • NO_BOOT (This should be the case if the Set-HPiLOVMStatus command has not been run, or if -VMBootOption is BOOT_ONCE and the server has already rebooted more than once.)


The VM_APPLET parameter above corresponds to "Image File (CD-ROM/DVD)" checkbox under Virtual Drives menu of the iLO Integrated Remote Console. This option is not available in the iLO PowerShell Cmdlets. Only ImageURL (requires a web server) can be specified.



1. Using HP iLO Scripting Tools for Windows

2. HPE Scripting Tools for Windows PowerShell User Guide - iLO Cmdlets [PDF]

3. HPE iLO 4 Scripting and Command Line Guide [PDF]

4. How to create an ISO image for UEFI platforms for a Windows PE CD-ROM for Windows Server 2008

5. Creating an .iso file from a .wim file (Updated)

To create a bootable media by using a .wim file, you need to convert it to an .iso file first.

To create a PE image (.iso file) from the resulting .wim file:

  1. Select Microsoft Windows AIK ® Windows PE Tools Command Prompt from the Start menu.

    Users of Windows 7 should select Microsoft Windows AIK ® Deployment Tools Command Prompt from the Start menu.

    If you create WinPE 4.0 ISO, select Windows Kits ® Windows ADK ® Deployment and Imaging Tools Environment from the Start menu.

  2. Run the copype.cmd script to create a folder with Windows PE files. For example, from a command prompt, type:

    copype amd64 c:\winpe_x64

  3. Replace the default boot.wim file in your Windows PE folder with the newly created .wim file (for example, AcronisMedia.wim). If the AcronisMedia.wim file is located on c:\, then:

    For WinPE 3.0, type:

    copy c:\AcronisMedia.wim c:\winpe_x64\ISO\sources\boot.wim

    For WinPE 4.0 or WinPE 5.0, type:

    copy "c:\AcronisMedia.wim" c:\winpe_x64\media\sources\boot.wim

  4. Use the Oscdimg tool. To create an .iso file, type:

    oscdimg -n –bc:\winpe_x64\ c:\winpe_x64\ISO c:\winpe_x64\winpe_x64.iso

    Alternatively, to make the media bootable on both BIOS and UEFI computers, type:

    oscdimg -m -o -u2 -udfver102 -bootdata:2#p0,e,bc:\winpe_x64\,e,bc:\winpe_x64\efisys.bin c:\winpe_x64\ISO c:\winpe_x64\winpe_x64.iso

  5. Burn the .iso file to a CD using a third-party tool (for example, Nero) and you will have a bootable Windows PE disc with Acronis True Image 2016.

6. Windows boot iso file without press any key

It depends on the BIOS. If it is a traditional PC BIOS then the ISO uses the El Torito boot code ( In this case deleting \boot\bootfix.bin will work.

If it is an EFI BIOS then the ISO should use EFI boot code (efisys.bin). There is also a efisys_noprompt.bin boot code file that can be used when creating the ISO for EFI systems. Use that file instead if you want to eliminate the prompt.

You may bookmark or share this article using the following:


No comments :

Post a Comment

Related article thumbnails