Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object of type "PackageInstallResult. NULL cannot be converted to type "PackagePendingAction" #94

Closed
Dayflare opened this issue Jul 31, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@Dayflare
Copy link

Dayflare commented Jul 31, 2023

Version

1.5.5

Computer Model

20WE, 21A2

Problem

i get this error only when installing BIOS Firmware Updates with LSUClient. I can replicate this issue with Model 20WE and 21A2.
the BIOS Updates starts itself successfully and the user gets the restart prompt from the update.

All other updates i encountered work flawless and i really love the LSUClient, it's so easy to manage the Lenovo updates, much better than the offical Lenovo tool.

the log: (it's translated from german, powershell shows the error prompt in the local language of the notebook)

1 updates found
EXCLUSIVE: Processing package 'fncn42ww - BIOS Update - 10/11'.
Installing update 1 of 1: BIOS Update - 10/11
EXCLUSIVE: The package 'fncn42ww' does not require extraction.
EXCLUSIVE: Installing package fncn42ww ...
Object of type "PackageInstallResult. NULL cannot be converted to type 
"PackagePendingAction" due to invalid enumeration values. Specify one of the following enumeration values and try again. 
again. Possible enumeration values are "NONE;REBOOT_SUGGESTED;REBOOT_MANDATORY;SHUTDOWN." cannot be created.
In C:\Users\Test\Documents\WindowsPowerShell\Modules\LSUClient\1.5.5\public\Install-LSUpdate.ps1:156 characters:70
+ ...    = if ($installProcess.Info) { $installProcess.Info.Runtime } else ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ObjectCreationError

Additional context

my powershell skript:
i used the code snippets from the documentation, the reboot logic isn't implemented completely.

$i = 1

# Find updates
# $updates = Get-LSUpdate | Where-Object { $_.Installer.Unattended }
$updates = Get-LSUpdate
Write-Output "$($updates.Count) updates found"

# Download them all to the local disk
$updates | Save-LSUpdate -Verbose

# Then install
foreach ($update in $updates) {
 Write-Output "Installing update $i of $($updates.Count): $($update.Title)"
 [array]$results = Install-LSUpdate -Package $update -Verbose
 if ($results.PendingAction -contains 'REBOOT_MANDATORY') {
    # reboot immediately or set a marker for yourself to perform the reboot shortly
    Write-Output "Reboot required!"
 }
 if ($results.PendingAction -contains 'SHUTDOWN') {
    # shutdown immediately or set a marker for yourself to perform the shutdown shortly
    Write-Output "immidiate shutdown required!"
 }
 $i++
}
@Dayflare Dayflare added the bug Something isn't working label Jul 31, 2023
@jantari
Copy link
Owner

jantari commented Jul 31, 2023

Thanks for reporting this, it is a bug / oversight in the way I determine the PendingAction (here:

$PendingAction = if (-not $Success) {
'NONE'
} elseif ($installProcess.Info -is [BiosUpdateInfo]) {
if ($installProcess.Info.ActionNeeded -eq 'SHUTDOWN') {
'SHUTDOWN'
} elseif ($installProcess.Info.ActionNeeded -eq 'REBOOT') {
'REBOOT_MANDATORY'
}
} elseif ($PackageToProcess.RebootType -eq 0) {
'NONE'
} elseif ($PackageToProcess.RebootType -eq 3) {
'REBOOT_SUGGESTED'
} elseif ($PackageToProcess.RebootType -eq 5) {
'REBOOT_MANDATORY'
}
)

I can fix it in the next version which I want to release soon anyway.

But it is still interesting you got to this error because that BIOS update is of Reboot Type 1 which is supposed to mean that it forces a reboot after being installed (meaning it would therefore also abort LSUClient). I guess that did not happen to you - was the BIOS update install successful in this case?

@Dayflare
Copy link
Author

thanks for the really fast response!
the BIOS update was sucessfully installed in this case. The window with the firmware update prompt is shown and when the user clicks OK the notebook restarts and installs the update.
image

It's just that the script reported an error and quit with return code 1. I'm using PDQ to deploy the script.

i'm looking forward for the next release :)

@jantari
Copy link
Owner

jantari commented Jul 31, 2023

The fix for this is now out with LSUClient version 1.6.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants