OSDeploy / OSD

OSD Shared Functions
MIT License
144 stars 59 forks source link

Get-OSDCloudDriverpacks --> OS check #47

Open AkosBakos opened 1 year ago

AkosBakos commented 1 year ago

I have an example: Surface Laptop 3. When I am querying Get-OSDCloudDriverPacks | ? name -match 'Surface Laptop 3 15 Intel' --> getting two results

One is for Win10, and one is for Win11. I am staging my device with Win10, but I am receiving the driver pack for Win11, which cannot be applied in the specialize phase.

In the catalog we would have a tag for OS. 1

It would be nice to check with the $Global:OSDCloud:OSVersion which driver pack fits for the target OS. $DriverPack = Get-OSDCloudDriverPacks | Where-Object {($_.Product -contains $Get_ProductInfo) -and ($.OS -match $Params.OSVersion)}

OSDeploy commented 1 year ago

This is a known issue where OSDCloud will pick the latest released Driver Pack. While selecting the Win10 DriverPack is ideal for this 1 Model, there are other models where a Win10 DriverPack is several years old, and a more recent Win11 DriverPack is available. In that example, what should be selected? The DriverPack several years old?

As a workaround you can use OSDCloudGUI. If you are set on the Command Line and are using your own PowerShell Script as a wrapper, then write a few lines in before launching OSDCloud to set the DriverPack for your specific model. There are Global Variables you can set to do this.

AkosBakos commented 1 year ago

The released dates are the same. But somehow the W11 pack will downloaded, which is in this customer case wrong. Because the Win11 driver packs cannot be applied for Win10 OS. The specialize phase fails.

I was decided against using the DriverPack* global variables. Because I need the flexibility for different HWs.

So, my wrapper looks like so and it works: $Params = @{ OSVersion = "Windows 10" OSBuild = "21H2" OSEdition = "Pro" OSLanguage = "de-de" ZTI = $true Firmware = $true } Start-OSDCloud @Params

$Get_ProductInfo = (Get-MyComputerProduct) $DriverPack = Get-OSDCloudDriverPacks | Where-Object {($.Product -contains $Get_ProductInfo) -and ($.OS -match Params.OSVersion)}

Invoke-OSDCloudDriverPack.ppkg does the magic ;-)

OSDeploy commented 1 year ago

Yes, the Release Date is the same, but in a single file line, there can't be a tie. One of them has to "win"

OSDeploy commented 1 year ago

Again, I am aware of this and will resolve when time allows, and assuming this is the top Priority. I'm tight on time, and since there are workarounds that can be done, the Priority is not high. OSDCloudGUI allows the selection, I apologize if the Command Line doesn't, but if you want to spend time updating the script and make a Pull Request, feel free, I'd appreciate it.

skyblaster commented 1 year ago

Hi @AkosBakos

Would you be so kind as to re-paste your workaround above in a code block. There is some non-rendered text, which makes it hard to evaluate. Thanks!

AkosBakos commented 1 year ago

Sure, @skyblaster - here we are: $DriverPack = Get-OSDCloudDriverPacks` | Where-Object {($_.Product -contains $Get_ProductInfo) -and ($.OS -match $Params.OSVersion)}

Or either look at this script here: https://github.com/AkosBakos/OSDCloud/blob/main/MicrosoftSurfaceDriverIssue.ps1

OSDeploy commented 1 year ago

I've made changes to the DriverPack selection in this month's OSDCloud update, can you please revalidate to see if this is still an issue?

skyblaster commented 1 year ago

I encountered this issue with a Dell 3520 using OSD 23.3.29.1. I'm using OSDPad to call a script with the following contents, however the Win11 driver pack was automatically downloaded:

Start-OSDCloud -OSVersion 'Windows 10' -OSBuild 22H2 -OSEdition Pro -OSLanguage en-us -OSLicense Retail -Firmware -Verbose
OSDeploy commented 1 year ago

Ahh, so you won't get many of the changes if you are using the Start-OSDCloud function as I plan on killing that off. It will be replaced in the future with Start-OSCloudCLI. Keep in mind the new function should not be used for anything production related until it is released, but you can test it out and see how it works for now. As far as killing off Start-OSDCloud, I won't remove it, but it will not get any new OS's added and it will not be linked to Azure AI, and obviously the updated driver pack matching won't work

image
skyblaster commented 1 year ago

I'd love to test Start-OSDCloudCLI, but can't seem to figure out how to get around the following: https://github.com/OSDeploy/OSD/blob/a89b1276a4f008686bf9ddb8c898df9c501690e9/Public/Start-OSDCloudCLI.ps1#L14 https://github.com/OSDeploy/OSD/blob/a89b1276a4f008686bf9ddb8c898df9c501690e9/Public/Start-OSDCloudCLI.ps1#L711

OSDeploy commented 1 year ago

I'd love to test Start-OSDCloudCLI, but can't seem to figure out how to get around the following:

https://github.com/OSDeploy/OSD/blob/a89b1276a4f008686bf9ddb8c898df9c501690e9/Public/Start-OSDCloudCLI.ps1#L14

https://github.com/OSDeploy/OSD/blob/a89b1276a4f008686bf9ddb8c898df9c501690e9/Public/Start-OSDCloudCLI.ps1#L711

It's not ready yet ... expect bugs

StevenVBeek commented 10 months ago

Hi @OSDeploy

We're encountering the same problem where a Windows 11 driver pack is being installed on a Windows 10 device, even though the Windows 10 driver pack is actually more up-to-date. This mismatch is causing various issues.

Is it now possible to check which OS version is installed and, based on that information, obtain the appropriate driver pack?

We use the Start-OSDCloud (Invoke-OSDCloud)

image

gwblok commented 8 months ago

@StevenVBeek, have you resolved your issue yet? I'm looking at the underlining code, and you should be able to do this today by pre-setting some variables before you call Start-OSDCloud

Here is a snip from my script to trigger OSDCloud on my HP Devices:

Variables to define the Windows OS / Edition etc to be applied during OSDCloud

$OSVersion = 'Windows 10' #Used to Determine Driver Pack $OSReleaseID = '22H2' #Used to Determine Driver Pack $OSName = 'Windows 10 22H2 x64' $OSEdition = 'Pro' $OSActivation = 'Retail' $OSLanguage = 'en-us'

Used to Determine Driver Pack

$Product = (Get-MyComputerProduct) $DriverPack = Get-OSDCloudDriverPack -Product $Product -OSVersion $OSVersion -OSReleaseID $OSReleaseID

Set OSDCloud Vars

$Global:MyOSDCloud = [ordered]@{ Restart = [bool]$False RecoveryPartition = [bool]$true OEMActivation = [bool]$True WindowsUpdate = [bool]$true WindowsUpdateDrivers = [bool]$true WindowsDefenderUpdate = [bool]$true SetTimeZone = [bool]$False ClearDiskConfirm = [bool]$False }

if ($DriverPack){ $Global:MyOSDCloud.DriverPackName = $DriverPack.Name }

Enable HPIA | Update HP BIOS | Update HP TPM

if (Test-HPIASupport){

$Global:MyOSDCloud.DevMode = [bool]$True

$Global:MyOSDCloud.HPTPMUpdate = [bool]$True
$Global:MyOSDCloud.HPIAALL = [bool]$true
$Global:MyOSDCloud.HPBIOSUpdate = [bool]$true

}

write variables to console

$Global:MyOSDCloud

Launch OSDCloud

Write-Host "Starting OSDCloud" -ForegroundColor Green write-host "Start-OSDCloud -OSName $OSName -OSEdition $OSEdition -OSActivation $OSActivation -OSLanguage $OSLanguage"

Start-OSDCloud -OSName $OSName -OSEdition $OSEdition -OSActivation $OSActivation -OSLanguage $OSLanguage