OSDeploy / OSD

OSD Shared Functions
MIT License
150 stars 61 forks source link

URLs in IntelWirelessDriverPack.json Offline Catalog file and Get-IntelWirelessDriverPack functions are outdated #101

Closed christiandekker closed 7 months ago

christiandekker commented 9 months ago

Describe the bug In the OSD PowerShell module, the Catalogs\IntelWirelessDriverPack.json file contains broken links for all DriverUrls. When trying to update the Offline Catalog using the -UpdateModuleCatalog parameter of the Get-IntelWirelessDriverPack cmdlet, the cmdlet reverts to the offline version of the cmdlet, because the $DriverUrl variable in the function contains a broken link (https://www.intel.com/content/www/us/en/support/articles/000017246/network-and-i-o/wireless-networking.html) .

To Reproduce The issue described above causes a failure when OSDCloud is trying to download drivers for WinPE during execution of the Edit-OSDCloudWinPE cmdlet when the parameter -CloudDriver is used.

Expected behavior The (latest) Intel Wireless Drivers should be downloaded.

Screenshots

PS C:\Users\ChristianDekkerLemon> Get-IntelWirelessDriverPack -Online -Verbose
VERBOSE: Test-WebConnection OK:
https://www.intel.com/content/www/us/en/support/articles/000017246/network-and-i-o/wireless-networking.html
VERBOSE: HEAD with 0-byte payload
VERBOSE: Test-WebConnection FAIL:
https://www.intel.com/content/www/us/en/support/articles/000017246/network-and-i-o/wireless-networking.html
VERBOSE: Catalog is running Offline

Information:

skyblaster commented 9 months ago

Also, I highly recommend the latest driver (23.10.0.8) as it fixes WPA3 in the 9560 chipset. Shoutout to https://github.com/OSDeploy/OSD/pull/69

gwblok commented 9 months ago

So Intel's site changed and it now blocks using Invoke-WebRequest to pull back information. I've completely changed the process for getting Intel WiFi Drivers, while it's working in dev, I haven't done any formal testing. Hopefully next week I'll get around to it.

Changes are posted in GitHub, and will be active the next time the module is released. You can look at the updated offline catalog here: https://github.com/OSDeploy/OSD/blob/master/Catalogs/IntelWirelessDriverPack.json

gwblok commented 8 months ago

This should be resolved, if @skyblaster and @christiandekker could confirm, that would be great.

skyblaster commented 8 months ago

I haven't actually used Wi-Fi in OSD for quite some time, so I'll defer to @christiandekker I can tell you however that there is an even newer driver (23.20.0.4) as of two days ago.

christiandekker commented 8 months ago

Hi @gwblok,

I'm getting an error, because of an empty variable $GitHubFolder in Get-IntelWirelessDriverPack.ps1:

Get-Content : Cannot find path 'C:\OSD\Catalogs\IntelWirelessDriverPack.json' because it does not exist. At C:\Users\ChristianDekkerLemon\OneDrive - Lemontree B.V\Documenten\WindowsPowerShell\Modules\OSD\24.1.3.1\Public\Functions\Catalogs\Intel\Get-IntelWirelessDriverPack.ps1:73 char:29

I think line 71 needs to be uncommented and line 72 commented :)

gwblok commented 8 months ago

thank @christiandekker That was my bad, I had changed a line to test on my test machine, and forgot to comment it out and put the original line back in. I've updated github, so it should be resolved next module update, or if you manually edit that file.

christiandekker commented 8 months ago

@gwblok

Update: After uncommenting line 71 and commenting line 72 it's still not working, because IntelWirelessDriverPack.json still seems outdated : Intel Wireless Driver Pack [23.10.0] https://downloadmirror.intel.com/794468/WiFi-23.10.0-Driver64-Win10-Win11.zip WARNING: Unable to connect to https://downloadmirror.intel.com/794468/WiFi-23.10.0-Driver64-Win10-Win11.zip

Running Get-IntelWirelessDriverPack -UpdateModuleCatalog doesn't seem to update the IntelWirelessDriverPack.json catalog file

gwblok commented 8 months ago

I wonder why it didn't work for you... I just edit that file quick, then ran the command

image

Note, I updated the JSON catalog on GitHub as well.

christiandekker commented 8 months ago

My bad. It just seems like the file https://downloadmirror.intel.com/812774/WiFi-23.20.0-Driver64-Win10-Win11.zip does not exist. File https://downloadmirror.intel.com/812774/WiFi-23.20.0-Driver64-Win10-Win11.exe does exist.

software-configurations.json contains just the .exe filename, but I'm assuming the .zip files were there in your testing, since the rename from .exe to .zip seems to be deliberate ($WiFiZipURL = $WiFiURL.replace(".exe",".zip"))? Apparently Intel doesn't provide a ZIP anymore on this URL?

The correct URL for the ZIP file is https://downloadmirror.intel.com/812775/WiFi-23.20.0-Driver64-Win10-Win11.zip in this case, the difference being 812774 vs 812775 in the URL. Wondering if there's any logic to the numbering here.

gwblok commented 8 months ago

oh man, last release the URLs were identical for the .exe & the .zip for rest of the process to work without extra changes, we needed to download a zip file. I was really hoping that Intel kept their URLs the same (exe & zip).

I will have to add some extra error handling into the function to double check the .zip URL.
Otherwise I'll have to see if there is a way to extract the exe without installing.

If you have any ideas, let me know. This is a back burner item for me at the moment. Appreciate your testing.

christiandekker commented 8 months ago

I've created some sample code that might be an idea to help determine the correct URL. Basically it will test multiple URLs:

I'm just not sure how to handle the situation where no valid URL can be found without rewriting bigger parts of the function. I think this should be a terminating event for the function, but I can't assess the impact this might have in other parts of the OSD module

`

$WiFiZipURL = $WiFiURL.replace('.exe', '.zip')

# Retrieve the Catalog number from the Download URL
$WiFiZipURLCatalogNumber = ([int]($WiFiZipURL.Split('/') | Select-Object -Last 1 -Skip 1))

# Generate array of multiple URLs to try
# - Original $WiFiZipURL
# - Original $WiFiZipURL with the catalog number increased by 1
$WiFiZipURLs = @(
    $WiFiZipURL,
    ($WiFiZipURL -replace $WiFiZipURLCatalogNumber, ($WiFiZipURLCatalogNumber + 1))
)

# Test if one of the $WiFiZipURLs exists
$WiFiZipURLExists = $false
foreach ($WiFiZipURL in $WiFiZipURLs)
{
    try
    {
        $WiFiZipURLWebRequest = Invoke-WebRequest -Uri $WiFiZipURL -Method Head -ErrorAction Stop
        if($WiFiZipURLWebRequest.StatusCode -eq 200)
        {
            $WiFiZipURLExists = $true
            break
        }
    }
    catch
    {
        # Tested URL does not exist
    }
}

if($WiFiZipURLExists -eq $false)
{
    Write-Error -Message ('Unable to retrieve a valid Intel Wireless Driver Pack Download URL')
    Exit
}

`

gwblok commented 8 months ago

Thanks for the code, I've incorporated it for now and I've updated the catalog, so at least the offline catalog has the correct URL for now. If you want to use these updates, you'll just want to overwrite these two files in your module.

Really appreciate your help on this.

Now I just need to find time to test it out when building a WinRM boot media.

gwblok commented 7 months ago

I haven't had time to test this, but if anyone has issues, please re-open