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

Windows 11 detection #48

Closed
animentork opened this issue Jan 27, 2022 · 3 comments
Closed

Windows 11 detection #48

animentork opened this issue Jan 27, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@animentork
Copy link

animentork commented Jan 27, 2022

Version

1.3.4

Computer Model

20U6S3XQ00

Problem

The comparison of the installed Windows version to a driver Windows version dependency does not work as intended. Consequently, when a driver has a dependency on Windows 11, LSUClient will still install it on a Windows 10 machine. This can lead to blue screens!

In Test-MachineSatisfiesDependencies.ps1, this part of the code does not behave as you would expect:

        '_OS' {
            foreach ($entry in $Dependency.OS) {
                if ("$entry" -like "${CachedHardwareTable['_OS']}*") {
                    return 0
                }
            }

If you change the code as follows, it works:

        '_OS' {
            foreach ($entry in $Dependency.OS) {
                if ("$entry" -like ("{0}*" -f $CachedHardwareTable['_OS'])) {
                    return 0
                }
            }

You can easily try this yourself:

$test1 = "Win10"
$test2 = @{"_OS" = "Win10"}

"WIN11" -like "Win10*"  # ---> returns False
"WIN11" -like "${test1}*"  # ---> returns False
"WIN11" -like "${test2["_OS"]}*"  # ---> unexpectedly returns True!
"WIN11" -like ("{0}*" -f $test2["_OS"])  # ---> returns False

I think the asterisk * character behaves different when placed after the hashtable lookup. So I propose to change the line as shown above ort to something similar.

Great work, btw.!

Edit: This seems to be the problem:

"${test2["_OS"]}*"  # ---> returns *
"$($test2["_OS"])*"  # ---> returns Win10*

So you can change the line to:

if ("$entry" -like "$($CachedHardwareTable['_OS'])*") {

Additional context

No response

@animentork animentork added the bug Something isn't working label Jan 27, 2022
@jantari
Copy link
Owner

jantari commented Jan 27, 2022

I'll look into this later today, thanks a lot for the detailed issue!

@jantari
Copy link
Owner

jantari commented Jan 27, 2022

Thanks again, this will be fixed in the next version (1.4.0) which I'm hoping to release very shortly anyway - if I don't find any more problems during testing!

@jantari
Copy link
Owner

jantari commented Jan 29, 2022

Fixed in Version 1.4.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