Skip to content

Instantly share code, notes, and snippets.

@wandersick
Created April 12, 2020 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wandersick/2cc6600e94a847531bde9d969de6e98d to your computer and use it in GitHub Desktop.
Save wandersick/2cc6600e94a847531bde9d969de6e98d to your computer and use it in GitHub Desktop.
# Version: 1.0
# Last Update: 20 Oct 2015
# iLO Cmdlet Version (at the time): 1.2
# Author: wandersick (http://tech.wandersick.com)
$iloIP = "HP_iLO_IP_addr"
$iloUserName="administrator"
$iloPassword="********"
$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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment