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

Invoke-LenovoBIOSUpdate does not work with new ThinkPad models #359

Open
MrMortensen opened this issue Jun 2, 2023 · 3 comments
Open

Invoke-LenovoBIOSUpdate does not work with new ThinkPad models #359

MrMortensen opened this issue Jun 2, 2023 · 3 comments

Comments

@MrMortensen
Copy link

I have found out that the powershell script for Lenovo BIOS update, Invoke-LenovoBIOSUpdate.ps1, does work on some new ThinkPad models. That is the models:
ThinkPad T14 Gen 3 & 4
ThinkPad P14s Gen 3 & 4
ThinkPad T16 Gen 1 & 2
ThinkPad P16s Gen 1 & 2
Because the WinUPTP64.exe (used for 64-bit OS) doesn't exists in the BIOS update package. There is only WinUPTP.exe version.
This update that first check for WinUPTP64.exe and then WinUPTP.exe will solve the problem.

Line 127:
# WinUPTP bios upgrade utility file name
if (([Environment]::Is64BitOperatingSystem) -eq $true) {
$WinUPTPUtility = Get-ChildItem -Path $Path -Filter ".exe" -Recurse | Where-Object { $_.Name -like "WinUPTP64.exe" } | Select-Object -ExpandProperty FullName
if (!($WinUPTPUtility)) {
$WinUPTPUtility = Get-ChildItem -Path $Path -Filter "
.exe" -Recurse | Where-Object { $.Name -like "WinUPTP.exe" } | Select-Object -ExpandProperty FullName
}
}
else {
$WinUPTPUtility = Get-ChildItem -Path $Path -Filter "*.exe" -Recurse | Where-Object { $
.Name -like "WinUPTP.exe" } | Select-Object -ExpandProperty FullName
}

@baardhermansen
Copy link
Contributor

Always filter left whenever you can and don't use -Like if you don't intend to use wildcard.

Simplified version:

if ([Environment]::Is64BitOperatingSystem) {
    $WinUPTPUtility = Get-ChildItem -Path $Path -Filter "WinUPTP64.exe" -Recurse | Select-Object -ExpandProperty FullName
}

if (!($WinUPTPUtility)) {
    $WinUPTPUtility = Get-ChildItem -Path $Path -Filter "WinUPTP.exe" -Recurse | Select-Object -ExpandProperty FullName
}

@MrMortensen
Copy link
Author

MrMortensen commented Jun 21, 2023

There is an update, the first solution only works when Windows is installed.
There has been has been added the file WinPEUPTB.exe for updating BIOS via WinPE. The code should be updated to the following:

if ($TSEnvironment.Value("SMSTSinWinPE") -eq $true) {
$WinUPTPUtility = Get-ChildItem -Path $Path -Filter "*.exe" -Recurse | Where-Object { $
.Name -like "WINPEUPTP.exe" } | Select-Object -ExpandProperty FullName
}

if (([Environment]::Is64BitOperatingSystem) -eq $true -and !($WinUPTPUtility)) {
$WinUPTPUtility = Get-ChildItem -Path $Path -Filter "*.exe" -Recurse | Where-Object { $_.Name -like "WinUPTP64.exe" } | Select-Object -ExpandProperty FullName
}

if (!($WinUPTPUtility)) {
$WinUPTPUtility = Get-ChildItem -Path $Path -Filter "*.exe" -Recurse | Where-Object { $_.Name -like "WinUPTP.exe" } | Select-Object -ExpandProperty FullName
}

@gooooba
Copy link

gooooba commented Sep 4, 2023

Thank you, but it didn't work in PE. Two underscore's were were missing(typo I guess...). The code below works(tested).

if ($TSEnvironment.Value("_SMSTSinWinPE") -eq $true) {
$WinUPTPUtility = Get-ChildItem -Path $Path -Filter "*.exe" -Recurse | Where-Object { $_.Name -like "WINPEUPTP.exe" } | Select-Object -ExpandProperty FullName
}

if (([Environment]::Is64BitOperatingSystem) -eq $true -and !($WinUPTPUtility)) {
$WinUPTPUtility = Get-ChildItem -Path $Path -Filter "*.exe" -Recurse | Where-Object { $_.Name -like "WinUPTP64.exe" } | Select-Object -ExpandProperty FullName
}

if (!($WinUPTPUtility)) {
$WinUPTPUtility = Get-ChildItem -Path $Path -Filter "*.exe" -Recurse | Where-Object { $_.Name -like "WinUPTP.exe" } | Select-Object -ExpandProperty FullName
}

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

3 participants