OSDeploy / OSD

OSD Shared Functions
MIT License
130 stars 54 forks source link

HP BIOS failing to Update using CMSL #125

Closed dany20mh closed 3 months ago

dany20mh commented 3 months ago

Describe the bug A clear and concise description of what the bug is. When attempting to do BIOS update, I will received error message below.

PS>TerminatingError(): "Setting not found: 'Lock BIOS Version'"
>> TerminatingError(): "Setting not found: 'Lock BIOS Version'"
PS>TerminatingError(): "Setting not found: 'Lock BIOS Version'"
>> TerminatingError(): "Setting not found: 'Lock BIOS Version'"
PS>TerminatingError(): "Could not locate EFI partition. "
>> TerminatingError(): "Could not locate EFI partition. "
>> TerminatingError(): "Could not locate EFI partition. "
>> TerminatingError(): "Could not locate EFI partition. "
>> TerminatingError(): "Could not locate EFI partition. "
>> TerminatingError(): "Could not locate EFI partition. "
>> TerminatingError(): "Could not locate EFI partition. "
Could not locate EFI partition.
Could not locate EFI partition.
At X:\Program Files\WindowsPowerShell\Modules\HP.Firmware\1.7.1\HP.Firmware.psm1:1354 char:5
+     throw [System.Management.Automation.ItemNotFoundException]"Could  ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : SessionStateException

To Reproduce Steps to reproduce the behavior:

  1. Boot the device with USB
  2. Have HPBIOSUpdate set to true.
  3. Process fails with the error

Value below is set for deployment.

$Global:StartOSDCloudGUI = [ordered]@{
    ZTI                        = $true
    HPIADrivers                = $true
    HPIAFirmware               = $true
    HPTPMUpdate                = $true
    HPBIOSUpdate               = $true
    OSName                     = 'Windows 11 23H2 x64'
    OSEdition                  = 'Pro'
    OSActivation               = 'Retail'
    OSLanguage                 = 'en-us'
    updateDiskDrivers          = $true
    updateFirmware             = $true
    updateNetworkDrivers       = $true
    updateSCSIDrivers          = $true
    SyncMSUpCatDriverUSB       = $true
    WindowsUpdate              = $true
    WindowsUpdateDrivers       = $true
}

Attached Files: 2024-03-19-181031-Deploy-OSDCloud.log 2024-03-18-095002-Deploy-OSDCloud.log GI-thdPWoAAsPzJ GJCXf66XgAAQfyo

gwblok commented 3 months ago

Thanks, I'll take a look. No ETA on a solution

gwblok commented 3 months ago

My current plan is to take the HP BIOS Update and set it up as a Job that gets called, so if it fails, it should only fail the job, and not the entire process. I'm testing to idea to make sure it doesn't break anything else, however I won't be able to test your issue, as I haven't been able to reproduce your issue. (Could not locate EFI partition)

Once I have it where I'm happy, you'll be able to test by manually overwriting the OSDCloud.ps1 file in your module from the one I upload to GitHub. (I'll let you know when it's ready to test)

As @OSDeploy noted on Twitter, the other "Errors" are just due to the verbose switch called on BCDBoot.exe We could remove the the verbose logging and you wouldn't see it, but it's nice to see rest of the information: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/bcdboot-command-line-options-techref-di?view=windows-11

dany20mh commented 3 months ago

Got you. Let me know if you need me to do any testing, happy to help as much as I can.

gwblok commented 3 months ago

Updates to the file are done and posted on GitHub. You'll need to replace "C:\Program Files\WindowsPowerShell\Modules\OSD\24.3.10.1\Public\OSDCloud.ps1" with the one on GitHub: https://github.com/OSDeploy/OSD/blob/master/Public/OSDCloud.ps1

That will allow you to test.

dany20mh commented 3 months ago

I saw the module updated today (to 24.3.20.1) so I tested it, and now I'm getting this, and it breaks the process too.

2024-03-20-182402
HP Enterprise Options Setup
 Confirmed Internet Connectivity
 Confirmed HP Tools Supported [Test-HPIASupport]
 Confirm HPCMSL Installed [Install-ModuleHPCMSL]
HPCMSL is not Installed
Install-Module HPCMSL 1.7.1 [AllUsers]
Checking HP BIOS Version via HPCMSL
 HP BIOS Ver Available: 1.27.0
 Installed BIOS Ver: 1.25.0
PS>TerminatingError(): "Setting not found: 'Enhanced BIOS Authentication Mode'"
>> TerminatingError(): "Setting not found: 'Enhanced BIOS Authentication Mode'"
PS>TerminatingError(): "Setting not found: 'Setup Password'"
>> TerminatingError(): "Setting not found: 'Setup Password'"
>> TerminatingError(): "Setting not found: 'Setup Password'"
>> TerminatingError(): "Setting not found: 'Setup Password'"
>> TerminatingError(): "Setting not found: 'Setup Password'"
>> TerminatingError(): "Setting not found: 'Setup Password'"
Setting not found: 'Setup Password'
Setting not found: 'Setup Password'
At X:\Program Files\WindowsPowerShell\Modules\HP.ClientManagement\1.7.1\HP.ClientManagement.psm1:105 char:5
+     throw [System.Management.Automation.ItemNotFoundException]$Err
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : SessionStateException
gwblok commented 3 months ago

@dany20mh, what platform is that? You're not even getting to the update now.

I'm assuming it's getting hung up on the Get-HPSureAdminState.

Can you run that command manually to see your output? In the future, if you can upload the entire log, it's really helpful. Thanks

gwblok commented 3 months ago

Just another note, I like to add HPCMSL into the OSDCloud boot image: Edit-OSDCloudWinPE -PSModuleInstall HPCMSL

I tested again just now on my oldest device (Elitebook 850 G4), and the process worked fine.

Can you run these two commands manually and see their results:

  1. Get-HPSureAdminState
  2. Get-HPBIOSSetupPasswordIsSet

Thanks

dany20mh commented 3 months ago

Here is the log.

My OSDCloud image is older than last year, and I can try to create a new one and add HPCMSL in there too.

Just a question, will the module get updated later during the process when it exists?

2024-03-20-181919-Deploy-OSDCloud.log

gwblok commented 3 months ago

@dany20mh, I would need to double check the code, but I think it will update HPCMSL if it's not current.

I'm not sure why HPCMSL is acting that way on your device. Things I'd try:


#Make Sure you're running 24.3.20.1
Update-Module -name OSD -Force

#Restart PowerShell after OSD has been updated (if it needed to be updated)

#Setup WorkSpace Location
Import-Module -name OSD -force
$OSDCloudWorkspace = "C:\OSDCloudWinPE"
[void][System.IO.Directory]::CreateDirectory($OSDCloudWorkspace)

#New Template (After you've updated ADK to lastest Version)
New-OSDCloudTemplate -Name "OSDCloudWinPE"

#New WorkSpace
New-OSDCloudWorkspace -WorkspacePath $OSDCloudWorkspace

#Added HPCMSL into WinPE
Edit-OSDCloudWinPE -PSModuleInstall HPCMSL

#Update the Cloud USB drive
Update-OSDCloudUSB
dany20mh commented 3 months ago

So I created a new image and tried to add HPCMSL and I got error below:

PS C:\Users\xyz> Edit-OSDCloudWinPE -PSModuleInstall HPCMSL                                                        
2024-03-20-131114 Mounting C:\OSDCloudWinPE\Media\Sources\boot.wim                                                      
2024-03-20-131234 Copying C:\OSDCloudWinPE\Config to X:\OSDCloud\Config                                                 
            New File                 769        C:\OSDCloudWinPE\Config\AutopilotJSON\AutopilotProfile.json
2024-03-20-131234 Startnet.cmd: Reset to defaults
@ECHO OFF
wpeinit
cd\
title OSD 24.3.20.1
PowerShell -Nol -C Initialize-OSDCloudStartnet
PowerShell -Nol -C Initialize-OSDCloudStartnetUpdate
2024-03-20-131235 Startnet.cmd: Start PowerShell in new Window
@ECHO OFF
start PowerShell -NoL
2024-03-20-131235 Saving OSD Module to X:\Program Files\WindowsPowerShell\Modules
2024-03-20-131407 Saving HPCMSL to C:\Users\xyz\AppData\Local\Temp\Mount1353678946\Program Files\WindowsPowerShell\Modules
Save-Module : A parameter cannot be found that matches parameter name 'AcceptLicense'.
At C:\Program Files\WindowsPowerShell\Modules\OSD\24.3.20.1\Public\OSDCloudSetup\OSDCloudWinPE.ps1:414 char:105
+ ... ntPath\Program Files\WindowsPowerShell\Modules" -Force -AcceptLicense
+                                                            ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Save-Module], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Save-Module

I boot the device and this time the BIOS update didn't fail.

2024-03-21-002701
HP Enterprise Options Setup
 Confirmed Internet Connectivity
 Confirmed HP Tools Supported [Test-HPIASupport]
 Confirm HPCMSL Installed [Install-ModuleHPCMSL]
HPCMSL is not Installed
Install-Module HPCMSL 1.7.1 [AllUsers]
Checking HP BIOS Version via HPCMSL
 HP BIOS Ver Available: 1.27.0
 Installed BIOS Ver: 1.25.0
Starting HP BIOS Update Process Job using HPCMSL [Get-HPBIOSUpdates -Flash -Yes -Offline -BitLocker Ignore]
Current Firmware: 1.25.00
Staging Update: 1.27.00
BIOS Update Job ID: 80
See Log: C:\OSDCloud\Logs\HPBIOSUpdateJob.log for Details
Completed running Job to Update BIOS
Firmware image has been deployed. The process will continue after reboot.
HP TPM Update: False
BIOS Setting: TPM Device is NOT Available on this Hardware
BIOS Setting: TPM State is NOT Available on this Hardware
BIOS Setting: TPM Activation Policy is NOT Available on this Hardware
Adding HP Tasks into JSON Config File for Action during Specialize and Setup Complete
HPIA Drivers = True | HPIA Firmware = True | HPIA Software = True | HPIA All = False
HP TPM Update = True | HP BIOS Update = True | HP BIOS WU Update = False
Running HPIA during Setup Complete will add about 20 Minutes to OOBE (Just a moment...)
Set-OSDCloudUnattendSpecializeDEV
Invoke-Exe 'reg' Arguments 'load HKLM\TempSYSTEM C:\Windows\System32\Config\SYSTEM'
The operation completed successfully.
Invoke-Exe 'reg' Arguments 'add HKLM\TempSYSTEM\Setup /v UnattendFile /d C:\Windows\Panther\Invoke-OSDSpecializeDev.xml /f'
The operation completed successfully.
Invoke-Exe 'reg' Arguments 'unload HKLM\TempSYSTEM'
The operation completed successfully.

If you need full logs or anything else, let me know.

I can try to test this on a couple of different machines and see how it goes.

gwblok commented 3 months ago

Ok, so the error you got on the first screen means you need to update some other modules first on your endpoint.

if you run "Install-ModuleHPCMSL" on your endpoint, it should install the pre-reqs PowerShellGet 2.2.5

The older version of PowerShellGet doesn't support the -AcceptLicense parameter, which is needed to install HPCMSL

Really glad to see it is working for you now! I was scratching my head on that for a while.

dany20mh commented 3 months ago

Had to install PowerShellGet manually, which did the trick for the initial error.

I will do more testing and let you know if any issue pops up.

I appreciate the quick help with this.

dany20mh commented 3 months ago

I just tested another computer, and the issue is resolved.