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

Script 'bails out' when multiple packages are added to the BIOS package list #1

Open
brinkenb opened this issue Dec 18, 2020 · 11 comments

Comments

@brinkenb
Copy link

brinkenb commented Dec 18, 2020

If there are multiple BIOS packages available for a single hardware model in my site, the script fails when trying to determine which BIOS package to use. The final line in the log file is 'Unable to determine a matching BIOS package from list since an unsupported count was returned from package list, bailing out.' I'm attaching a screenshot from the log file, thanks!

@brinkenb
Copy link
Author

Log

@brinkenb
Copy link
Author

image

@brinkenb
Copy link
Author

image

@Gor3t3x
Copy link

Gor3t3x commented Jan 12, 2021

Got same problem with HP Bios packages.

Because some baseboards share the same SKU, it seems to detect multiple packages. It's maybe OK for drivers, but shouldn't bios look for specific model instead?

@berny-rode
Copy link

same problem with HP Bios packages

@nodiaque
Copy link

Same with any bios in fact, it doesn't check for the latest version when there's multiple

@nodiaque
Copy link

nodiaque commented Feb 3, 2021

I've check the script and I understand the problem. Problem is here:

$PackageList = $PackageList | Sort-Object -Property SourceDate -Descending | Select-Object -First 1
							}

							if ($PackageList.Count -eq 1

Problem is after the select-object, the array doesn't exist anymore thus .count is null. I myself changed it to:

if ($PackageList.Count -lt 2 -and $PackageList[0] -ne $null) {

I'm still in the testing phase to see if that add another problem.

There's also other problem at the same place that I'll post another issue

@mstraessner
Copy link

mstraessner commented Feb 4, 2021

Hello, I troubleshooting this situation about 4 hour and can verify @nodiaque issue. It's a casting error.

Have made some changes, tested and works as desired.

The fast solution is too change code from line 1168 until 1187 with this:

`
if ($ComputerManufacturer -match "Dell") {
$PackageList = , $($PackageList | Sort-Object -Property SourceDate -Descending | Select-Object -First 1)
} elseif ($ComputerManufacturer -eq "Lenovo") {
$ComputerDescription = Get-WmiObject -Class Win32_ComputerSystemProduct | Select-Object -ExpandProperty Version
# Attempt to find exact model match for Lenovo models which overlap model types
$PackageList = , $($PackageList | Where-object {
($.Name -like "*$ComputerDescription") -and ($.Manufacturer -match $ComputerManufacturer)
} | Sort-object -Property SourceDate -Descending | Select-Object -First 1)

							If ($PackageList -eq $null) {
								# Fall back to select the latest model type match if no model name match is found
								$PackageList = , $($PackageList | Sort-object -Property SourceDate -Descending | Select-Object -First 1)
							}
						} elseif ($ComputerManufacturer -match "Hewlett-Packard|HP") {
							# Determine the latest BIOS package by creation date
							$PackageList = , $($PackageList | Sort-Object -Property PackageCreated -Descending | Select-Object -First 1)

						} elseif ($ComputerManufacturer -match "Microsoft") {
							$PackageList = , $($PackageList | Sort-Object -Property PackageCreated -Descending | Select-Object -First 1)
						}
						`

Hope it's help you all.

EDIT: I make a rull request #4

@m0nkiwitacaus
Copy link

m0nkiwitacaus commented Mar 4, 2021

Writing to confirm that the amendment that @mstraessner suggested is currently working for HP systems. I have not had the chance to test this with other manufacturers.

@HermanGB
Copy link

HermanGB commented Jun 4, 2021

I had to do multiple additional changes to get it to work with Lenovo.

`

						if ($ComputerManufacturer -match "Dell") {
                            [Array]$PackageList = , $($PackageList | Sort-Object -Property SourceDate -Descending | Select-Object -First 1)
                        } elseif ($ComputerManufacturer -eq "Lenovo") {
                            $ComputerDescription = Get-WmiObject -Class Win32_ComputerSystemProduct | Select-Object -ExpandProperty Version
                            # Attempt to find exact model match for Lenovo models which overlap model types
                        [Array]$PackageListExactModelMatch = , $($PackageList | Where-Object {($_.Name -like "*$ComputerDescription") -and ($_.Manufacturer -match $ComputerManufacturer)} | Sort-Object -Property SourceDate -Descending | Select-Object -First 1)

                        If ($PackageListExactModelMatch[0] -eq $null) {
                            # Fall back to select the latest model type match if no model name match is found
	                            [Array]$PackageList = , $($PackageList | Sort-Object -Property SourceDate -Descending | Select-Object -First 1)
                            } elseif ($PackageListExactModelMatch[0]) {
                                    # If match is found update Packagelist with correct model
                                    [Array]$PackageList = $PackageListExactModelMatch
                                }
                        } elseif ($ComputerManufacturer -match "Hewlett-Packard|HP") {
                            # Determine the latest BIOS package by creation date
                            [Array]$PackageList = , $($PackageList | Sort-Object -Property PackageCreated -Descending | Select-Object -First 1)

                        } elseif ($ComputerManufacturer -match "Microsoft") {
                            [Array]$PackageList = , $($PackageList | Sort-Object -Property PackageCreated -Descending | Select-Object -First 1)}

`

And changed this:
} elseif ($ComputerManufacturer -match "Lenovo") { Compare-BIOSVersion -AvailableBIOSVersion $PackageList[0].Version -AvailableBIOSReleaseDate $(($PackageList[0].PackageDescription).Split(":")[2]).Trimend(")") -ComputerManufacturer $ComputerManufacturer }

To this:

} elseif ($ComputerManufacturer -match "Lenovo") { Compare-BIOSVersion -AvailableBIOSVersion $PackageList[0].Version -AvailableBIOSReleaseDate $(($PackageList[0].Description).Split(":")[2]).Trimend(")") -ComputerManufacturer $ComputerManufacturer }

@Jtracy-ItPro
Copy link

I got it to work with Lenovo ThinkCentre series after applying the fixes from @HermanGB - thanks everyone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants