HP BIOS Update through HPCMSL

2 posts / 0 new
Last post
Author
Message
dharmesh.vaghan...
Posted: 8 April 2021 - 1:39am
HP BIOS Update through HPCMSL

Hi,

I am having problems in updating the BIOS for few models. The script works okay with few models. The script checks if any latest BIOS updates are present or not through product code and it is able to find the BIOS updates but it is not able to convert value. I'm guessing it can't handle the declared [version]$CurrentBIOS because it has a string letter "A" in the bios. I am having this issue on few laptops.  Also for 840 G7 it is not able to download the BIOS update file from internet. The script i am using is pasted below and I have also added the error message which which I am getting.  Appreciate your quick help 

 

Checking Product Code 8595 for BIOS Updates RunPowerShellScript 4/6/2021 1:37:42 PM 12148 (0x2F74)

Process completed with exit code 0 RunPowerShellScript 4/6/2021 1:37:44 PM 12148 (0x2F74)

Cannot convert value "02.08.00 A 1" to type "System.Version". Error: "Input string was not in a correct format." RunPowerShellScript 4/6/2021 1:37:44 PM 12148 (0x2F74)

 

Script

__________________________________________________

$OS = "Win10"
$Category = "bios"
$HPContent = $ENV:TEMP
$DownloadDir = "$($HPContent)\Downloads"
$ExtractedDir = "$($HPContent)\Extracted"
$ProductCode = (Get-WmiObject -Class Win32_BaseBoard).Product
$Model = (Get-WmiObject -Class Win32_ComputerSystem).Model

$PoshURL = "https://ftp.hp.com/pub/softpaq/sp92001-92500/sp92327.exe"

try {
    Get-HPBiosVersion
    Write-Output "HP Module Installed"
    }

catch {
    Write-Output "HP Module Not Loaded, Loading.... Now"
    Invoke-WebRequest -Uri $PoshURL -OutFile "$($DownloadDir)\HPCM.exe"
    Start-Process -FilePath "$($DownloadDir)\HPCM.exe" -ArgumentList "-pdf -e -s -f$($DownloadDir)\HPCM" -Wait
    Start-Process -FilePath "$($DownloadDir)\HPCM\*.exe" -ArgumentList "/SILENT" -wait
    Write-Output "Finished Downloading and Installing HP Module"
    }

    
$CurrentBIOS = Get-HPBiosVersion
Write-Output "Current Installed BIOS Version: $($CurrentBIOS)"
Write-Output "Checking Product Code $($ProductCode) for BIOS Updates"
$BIOS = Get-SoftpaqList -platform $ProductCode -os $OS -category $Category
$MostRecent = ($Bios | Measure-Object -Property "ReleaseDate" -Maximum).Maximum
$BIOS = $BIOS | WHERE "ReleaseDate" -eq "$MostRecent"

if ([version]$CurrentBIOS -ne [version]$Bios.Version)
    {
    Write-Output "Updated BIOS available, Version: $([version]$BIOS.Version)"
    $DownloadPath = "$($DownloadDir)\$($BIOS.Version)"
    if (-not (Test-Path $DownloadPath)){New-Item $DownloadPath -ItemType Directory}
    $ExtractedPath = "$($ExtractedDir)\$($BIOS.Version)"
    if (-not (Test-Path $ExtractedPath)){New-Item $ExtractedPath -ItemType Directory}
    Write-Output "Downloading BIOS Update for: $($ProductCode)"
    Get-Softpaq -number $BIOS.ID -saveAs "$($DownloadPath)\$($BIOS.id).exe" -Verbose -overwrite
    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"
    Write-Output "Extracting Downloaded BIOS File to: $($ExtractedPath)"
    Start-Process "$($DownloadPath)\$($BiosFileName)" -ArgumentList " /s /e /f $($ExtractedPath)" -Wait
    #Start-Process "$($DownloadPath)\$($BiosFileName)" -ArgumentList " -s -r -b -f$($ExtractedPath)" -Wait
    #Start-Process "$($DownloadPath)\$($BiosFileName)" -ArgumentList " /SILENT $($ExtractedPath)" -Wait
    #Start-Process "$($DownloadPath)\$($BiosFileName)" -ArgumentList "-pdf -e -s -f$($ExtractedPath)" -wait
    if ((Get-BitLockerVolume -MountPoint c:).VolumeStatus -eq "FullyDecrypted")
        {
        Write-Output "Bitlocker Not Present"
        }
    Else
        {
        Write-Output "Suspending Bitlocker"
        Suspend-BitLocker -MountPoint "C:" -RebootCount 1
        }
    if (Test-Path "$($ExtractedPath)\HPBIOSUPDREC64.exe")
        {
        Start-Process "$($ExtractedPath)\HPBIOSUPDREC64.exe" -ArgumentList "-s -r -b -l$($HPContent)\HPBIOSUpdate.log" -wait
        Write-Output "Using HPBIOSUpdRec64.exe to Flash BIOS with Args -s -r -b -l"
        
        }
    if (Test-Path "$($ExtractedPath)\HPFirmwareUpdRec64.exe")
        {
        Start-Process "$($ExtractedPath)\HPFirmwareUpdRec64.exe" -ArgumentList "-s -r -b -l$($HPContent)\HPBIOSUpdate.log" -wait
        Write-Output "Using HPFirmwareUpdRec64.exe to Flash BIOS with Args -s -r -b -l"
        
        }
    Write-Output "HP BIOS update Applied, Will Install after next reboot"
    Start-Sleep -Seconds 10
    }
ELSE
    {Write-Output "BIOS already Current"} 

Top
Author
Message
dan.felman
Posted: 14 April 2021 - 12:35pm
Re: HP BIOS Update through HPCMSL

i think you may be putting too much complexity on your script... the HP CMSL can do a BIOS flash with a single command, so, assuming the CMSL is installed on your endpoints (highly recommended) you could be doing this as simply as

$up_to_date = Get-HPBiosUpdates –Check

if ( -not $up_to_date ) {

       Get-HPBiosUpdates –Flash [-Force]  [-Bitlocker suspend]

}

Top
Please login to comment