First off, I love SCConfigMgr Driver / BIOS download tool, super powerful and fully featured.
Sometimes you just want a lightweight script to run that will do a specific task over and over.
Using the HP Client Management Script Library, Documentation HERE, I’ve created a simple Script that will go through a list of models that I’ve created, and download the BIOS Files, then extract the bin file to a separate directory. (I delete all of the extra support EXE files, as I’d only want one set in my entire package, not one for each model) After this, I can then create a package around it, and deploy. I’m not including that process here today, just the download. I’ll probably blog more on this topic in the future, along with a script that runs locally on the machine that requires the update, which will download the update right from HP, then install it… but not today… UPDATE.. YES TODAY! Check it out HERE
Today, simple script to download BIOS file right from HP.
- Downloads BIOS for specified Models in Script into Download Source Folder Structure
- Extracts BIOS & Updater into “Package” Folder Structure
- If you re-run
- Skips current BIOS downloads by comparing Download Structure to what is available from HP
- if it finds updated BIOS available
- Downloads Updated BIOS into New Folder (Download Structure)
- Deletes old Package Contents and Updates it with the new BIOS (Package Structure)
<# Creator @gwblok - GARYTOWN.COM Used to download BIOS Updates from HP, then Extract the bin file. This Script was created to build a BIOS Update Package. Future Scripts based on this will be one that gets the Model / Product info from the machine it's running on and pull down the correct BIOS and run the Updater REQUIREMENTS: HP Client Management Script Library Download / Installer: https://ftp.hp.com/pub/caps-softpaq/cmit/hp-cmsl.html Docs: https://developers.hp.com/hp-client-management/doc/client-management-script-library-0 This Script was created using version 1.1.1 #> #Reset Vars $BIOS = "" $Model = "" $HPModelsTable = "" $HPModelName = "" $CurrentDownloadedVersion = "" $OS = "Win10" $Category = "bios" #$HPModels = @("80FC", "82CA") $DownloadDir = "C:\HPContent\Downloads" $ExtractedDir = "C:\HPContent\Packages\HP" $HPModelsTable= @( @{ ProdCode = '80FC'; Model = "Elite x2 1012 G1"} @{ ProdCode = '82CA'; Model = "Elite x2 1012 G2" } @{ ProdCode = '80FB'; Model = "EliteBook 1030 G1" } @{ ProdCode = '80FA'; Model = "EliteBook 1040 G3" } @{ ProdCode = '225A'; Model = "EliteBook 820 G2" } @{ ProdCode = '807C'; Model = "EliteBook 820 G3" } @{ ProdCode = '2216'; Model = "EliteBook 840 G2" } @{ ProdCode = '8079'; Model = "EliteBook 840 G3" } ) $HPModelName = $HPModelsTable | ? ProdCode -eq $Model | % Model foreach ($Model in $HPModelsTable) { Write-Output "Checking Product Code $($Model.ProdCode) for BIOS Updates" $BIOS = Get-SoftpaqList -platform $Model.ProdCode -os $OS -category $Category if (Test-Path "$($DownloadDir)\$($Model.Model)"){$CurrentDownloadedVersion = (Get-childitem -Path "$($DownloadDir)\$($Model.Model)").Name} $MostRecent = ($Bios | Measure-Object -Property "ReleaseDate" -Maximum).Maximum $BIOS = $BIOS | WHERE "ReleaseDate" -eq "$MostRecent" $DownloadPath = "$($DownloadDir)\$($Model.Model)\$($BIOS.Version)" $ExtractedPath = "$($ExtractedDir)\$($Model.Model)" if (-not (Test-Path "$($DownloadPath)")) { if ($CurrentDownloadedVersion) {Write-Output "Update Found, Replacing $([decimal]$CurrentDownloadedVersion) with $([decimal]$BIOS.Version)"} Else {Write-Output "Update Found, Downloading: $([decimal]$BIOS.Version)"} Write-Output "Downloading BIOS Update for: $($Model.Model) aka $($Model.ProdCode)" Get-Softpaq -number $BIOS.ID -saveAs "$($DownloadPath)\$($BIOS.id).exe" -Verbose Write-Output "Creating Readme file with BIOS Info HERE: $($DownloadPath)\$($Bios.ReleaseDate).txt" $BIOS | Out-File -FilePath "$($DownloadPath)\$($Bios.ReleaseDate).txt" $BiosFileName = Get-ChildItem -Path "$($DownloadPath)\*.exe" | select -ExpandProperty "Name" if (Test-path $ExtractedPath) { Write-Output "Deleting $($ExtractedPath) Contents before extracting new contents" remove-item -Path $ExtractedPath -Recurse -Force } Write-Output "Extracting Downloaded BIOS File to: $($ExtractedPath)" Start-Process "$($DownloadPath)\$($BiosFileName)" -ArgumentList "-pdf -e -s -f$($ExtractedPath)" -wait #Start-Sleep -Seconds 2 $BIOS | Out-File -FilePath "$($ExtractedPath)\$([decimal]$Bios.Version).txt" #Start-Sleep -Seconds 2 #Write-Output "Deleting support files, leaving only the BIOS.bin file & 64Bit Updater" Remove-Item -Path "$($ExtractedPath)\*.rtf" -Verbose Remove-Item -Path "$($ExtractedPath)\*.log" -Verbose Remove-Item -Path "$($ExtractedPath)\Hpq*.exe" -Verbose Remove-Item -Path "$($ExtractedPath)\HPBIOSUPDREC.exe" -Verbose Start-Sleep -Seconds 3 } Else {Write-Output "No New BIOS Available"} }
File Output – Downloads Folder:
Extracted Folder:
Posted at GARYTOWN.COM
There are a lot of commands here I don’t understand where they are coming from. Such as “Get-SoftpaqList” how do I get these commands to run? What am I missing?
They are part of the HPCMSL. You can look up all of that information on the HP’s Site documentation for the HPCMSL.
How do i get the ProdCode for a “HP Z2 Tower G4 Workstation”
https://docs.recastsoftware.com/ConfigMgr-Docs/ConfigMgr-Topics/Manufacturer-Tools.html#hp-2
this looks nice but can’t get this ” Start-Process “$($DownloadPath)\$($BiosFileName)” -ArgumentList “-pdf -e -s -f$($ExtractedPath)” -wait”
working, all paths are correct and the file is downloaded but it does not extract
You might want to play around with that argument, perhaps it has changed.
Otherwise, you can look at this: https://github.com/gwblok/garytown/blob/master/hardware/HP_BIOS_PopulateCMPackage.ps1
That’s my updated script I use now.
Instead of using get-softpaq, you can leverage the Get-HPBIOSUpdates commandlet.