Facing Issues Updating BIOS and Firmware on HP Devices

0
13
Asked By TechieGuru42 On

I'm working on a script to update the BIOS and firmware drivers for many HP devices as part of preparing for Secure Boot CA updates. However, since these devices are managed by a Remote Monitoring and Management (RMM) tool and not systems like Intune or SCCM, my automation options are quite limited. I decided to use HP's Client Management Scripting Library (CMSL) for this.

Here's a snippet of my current script:

```powershell
$HPCMSLDownloadPath = "C:Temphp-cmsl-1.8.5.exe"
$HPScriptsPath = "C:TempHP-Scripts"
# Create the directory if it doesn't exist
if (!(Test-Path -Path $HPScriptsPath)) {
New-Item -Path $HPScriptsPath -ItemType Directory
}

$Error.Clear()
try {
Write-Output "Downloading HP Scripting Library."
$Params = @{
Uri = "https://hpia.hpcloud.hp.com/downloads/cmsl/hp-cmsl-1.8.5.exe"
OutFile = $HPCMSLDownloadPath
Method = "Get"
UseBasicParsing = $true
UserAgent = ([Microsoft.PowerShell.Commands.PSUserAgent]::Chrome)
}
Invoke-WebRequest @Params
} catch {
Write-Output $Error[0].Exception.Message
return
}

# Extracting scripts
Write-Output "Extracting scripts to $HPScriptsPath."
Start-Process $HPCMSLDownloadPath -ArgumentList "/VERYSILENT /SP- /UnpackOnly=`"True`" /DestDir=$HPScriptsPath" -Wait -NoNewWindow

# Import modules
Write-Output "Importing the HP modules."
Import-Module -Force "C:TempHP-ScriptsModulesHP.ClientManagementHP.ClientManagement.psd1"

# Initialize HP Repository
Set-Location -Path "C:TempHP-Scripts"
Initialize-HPRepository
Add-HPRepositoryFilter -Platform $(Get-HPDeviceProductID) -Category Bios,Firmware
Invoke-HPRepositorySync

# Flash the BIOS
Write-Output "Flashing latest update version to the BIOS."
Get-HPBIOSUpdates -Flash -Version $(Get-HPBIOSVersion)
```

The script works fine until I try to operate on the BIOS. When I run just `Get-HPBIOSUpdates`, I receive an error stating `Unable to retrieve BIOS data for a platform with ID 8A0E (data file not found)` for various machines. Without a local repository, I encounter a different error: `Platform 8A0E doesn't exist. Please add a valid platform.` It seems my devices might not be recognized or supported by HP's CMSL. Has anyone else faced this problem or know how to resolve it?

1 Answer

Answered By CodeWhisperer87 On

I think I spotted something in your script: you should be using `$env:PROCESSOR_ARCHITECTURE` instead of `$env:PROCESSOR_ARCHITEW6432`. That could definitely be causing issues if it’s affecting how your script is executed. Also, if NinjaRMM runs it in 64-bit mode already, you might be able to skip that chunk altogether. Could you try that and see if it improves things?

Scripter81 -

Thanks for the tip! I updated it, but now I'm hitting errors again. Just to clarify, NinjaRMM seems to struggle handling that change. I also added some missing module imports, but I’m still stuck.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

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