Skip to content

Commit

Permalink
Invoke-HPBIOSUpdate.ps1 version 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
NickolajA committed Apr 30, 2019
1 parent 9557e0c commit f7a93b5
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions Operating System Deployment/BIOS/Invoke-HPBIOSUpdate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
Author: Lauri Kurvinen / Nickolaj Andersen
Contact: @estmi / @NickolajA
Created: 2017-09-05
Updated: 2018-06-14
Updated: 2019-04-30
Version history:
1.0.0 - (2017-09-05) Script created
1.0.1 - (2018-01-30) Updated encrypted volume check and cleaned up some logging messages
1.0.2 - (2018-06-14) Added support for HPFirmwareUpdRec utility - thanks to Jann Idar Hillestad ([email protected])
1.0.3 - (2019-04-30) Updated to support HPQFlash.exe and HPQFlash64.exe
#>

[CmdletBinding(SupportsShouldProcess = $true)]
Expand Down Expand Up @@ -118,6 +119,14 @@ Process {
$HPFirmwareUpdRec = Get-ChildItem -Path $Path -Filter "*.exe" -Recurse | Where-Object { $_.Name -like "HpFirmwareUpdRec.exe" } | Select-Object -ExpandProperty FullName
}

# Attempt to detect HPFirmwareUpdRec utility file name
if (([Environment]::Is64BitOperatingSystem) -eq $true) {
$HPFlashUtil = Get-ChildItem -Path $Path -Filter "*.exe" -Recurse | Where-Object { $_.Name -like "HPQFlash.exe" } | Select-Object -ExpandProperty FullName
}
else {
$HPFlashUtil = Get-ChildItem -Path $Path -Filter "*.exe" -Recurse | Where-Object { $_.Name -like "HPQFlash64.exe" } | Select-Object -ExpandProperty FullName
}

if ($HPBIOSUPDUtil -ne $null) {
# Set required switches for silent upgrade of the bios and logging
Write-CMLogEntry -Value "Using HPBIOSUpdRec BIOS update method" -Severity 1
Expand All @@ -133,6 +142,14 @@ Process {
$FlashSwitches = " -s -r"
$FlashUtility = $HPFirmwareUpdRec
}

if ($HPFlashUtil -ne $null) {
# Set required switches for silent upgrade of the bios and logging
Write-CMLogEntry -Value "Using HPFirmwareUpdRec BIOS update method" -Severity 1
# This -r switch appears to be undocumented, which is a shame really, but this prevents the reboot without exit code. The command now returns a correct exit code and lets ConfigMgr reboot the computer gracefully.
$FlashSwitches = " -s -r"
$FlashUtility = $HPFlashUtil
}

if (-not($FlashUtility)) {
Write-CMLogEntry -Value "Supported upgrade utility was not found." -Severity 3; exit 1
Expand Down Expand Up @@ -174,7 +191,7 @@ Process {

# Supend Bitlocker if $OSVolumeEncypted is $true
if ($OSDriveEncrypted -eq $true) {
Write-CMLogEntry -Value "Suspending BitLocker protected volume: $($env:SystemDrive)" -Severity
Write-CMLogEntry -Value "Suspending BitLocker protected volume: $($env:SystemDrive)" -Severity 1
Manage-Bde -Protectors -Disable C:
}

Expand Down

0 comments on commit f7a93b5

Please sign in to comment.