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

Bios Version - Longer then [Major.Minor.Build.Revision] #50

Closed
esoroach opened this issue Apr 6, 2018 · 9 comments
Closed

Bios Version - Longer then [Major.Minor.Build.Revision] #50

esoroach opened this issue Apr 6, 2018 · 9 comments

Comments

@esoroach
Copy link

esoroach commented Apr 6, 2018

Newer HP's handle version 1.0.0.0.5

But those wont work with "function ConvertTo-Version()"
MPSXM.psm1

Is there a simple way to make longer Versions Compatible with [System.Version]?

@texhex
Copy link
Owner

texhex commented Apr 6, 2018

Could you please post the link to the BIOS with this version, right now I would suspect the -RespectLeadingZeros option of the above mentioned function to be the problem. In case a BIOS version already uses all parts, the function will go bonkers.

@esoroach
Copy link
Author

esoroach commented Apr 6, 2018

HP EliteBook 830 G5
Q78 ver. 01.00.05 01/25/2018
But the script handels it like 1.0.0.0.5

So your comment makes sense;)

The following fix for [1.2.3.4.x] to merge at the end is not needed then.
But just to share would it ever happen:


try
{
# Handels 1.2.3.4.xxx and Merge [4.x] to [4x] so System.Version will accept the value
if ($count = ($Text.Split(".") | measure-object).count -ge 5)
{
$textbegin= $text | % { $.split('.')[0..3] -join '.' }
$textend = $text | % { $
.split('.')[-1] -join '.' }
$textcombine= $textbegin+$textend
[version]$version=$textcombine

        }
       else
        {
        # Just handels 1.2.3.4
         [version]$version=$Text
        }

}

@texhex
Copy link
Owner

texhex commented Apr 6, 2018

Thanks, let me do some tests, I think we can skip the entire -RespectLeadingZeros for those new BIOS versions.

@texhex
Copy link
Owner

texhex commented Apr 6, 2018

The change only needs to be done in the function ConvertTo-VersionFromBIOSVersion() as this is the only place BIOS versions are parsed. The entire part with -RespectLeadingZeros was only designed for the "old" version numbers e.g. 1.03.

Given that HP now has adapted a system that looks like a real version number, the function is changed that it searches if the version contains only one dot (e.g. 1.03) and only use -RespectLeadingZeros in that case. In any other case, the version number is used as is. This code should also work if HP ever uses full versions like 1.00.03.256.

Here's the code part, this is the current version of BiosSledgehammer.ps1. No release so far, I hope to have a first 4.0 Beta release tomorrow.

#Issue 50 (https://github.com/texhex/BiosSledgehammer/issues/50):
#
#Newer BIOS versions (e.g. EliteBook 830 G5) use the version string "1.00.05" that will crash
#if the -RespectLeadingZeros parameter is used as the resulting version would be 1.0.0.0.5
#
#Therefore, check if the version only contains a single "." (dot) and only use -RespectLeadingZeros in that case
#
if ( ($Text.Split('.').Length - 1) -eq 1 )
{
[version]$curver = ConvertTo-Version -Text $Text -RespectLeadingZeros
}
else
{
#The version string contains more than one ., try to parse the version as is
[version]$curver = ConvertTo-Version -Text $Text
}
return $curver
}

@texhex
Copy link
Owner

texhex commented Apr 7, 2018

Version 4.0.5 (BETA) contains this change, please give it a try.

@esoroach
Copy link
Author

esoroach commented Apr 7, 2018

Your Fast!
I'll Test it Monday.

*made some other functions/improvements I like to share thoughts about.

@texhex
Copy link
Owner

texhex commented Apr 13, 2018

@esoroach Any updates on this please?

@dubl3a
Copy link

dubl3a commented Apr 25, 2018

@texhex I can confirm this working on 830 G5. Same errors were occurring before I pulled an updated copy with this fix.

@texhex
Copy link
Owner

texhex commented Apr 26, 2018

@dubl3a Thanks for the confirmation. Given that I also tested it in the meantime, I think it's save to close this issue now.

@texhex texhex closed this as completed Apr 26, 2018
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