OSDeploy / OSD

OSD Shared Functions
MIT License
150 stars 61 forks source link

Wrong OSImageIndex is selected if the WindowsImageCount for the ESD file equals 9 #63

Closed christiandekker closed 1 year ago

christiandekker commented 1 year ago

Situation: OSD Version: 23.4.12.2 Deployment method: OSDCloudGUI Operating System selection: Windows 11 22H2 x64 Pro nl-nl Retail (Index 9) ESD file: 22621.382.220806-0833.ni_release_svc_refresh_CLIENTCONSUMER_RET_x64FRE_nl-nl.esd

After deployment, Windows 11 Pro N is installed instead of Windows 11 Pro This is caused by the fact that the OSImageIndex for the Pro edition in this ESD file should be 8 instead of 9: PS C:\WINDOWS\system32> Get-WindowsImage -ImagePath 'D:\OSDCloud\OS\Windows 11 22H2\22621.382.220806-0833.ni_release_svc_refresh_CLIENTCONSUMER_RET_x64FRE_nl-nl.esd' |Select ImageName, ImageIndex ImageName ImageIndex Windows Setup Media 1 Microsoft Windows PE (amd64) 2 Microsoft Windows Setup (amd64) 3 Windows 11 Home 4 Windows 11 Home N 5 Windows 11 Education 6 Windows 11 Education N 7 Windows 11 Pro 8 Windows 11 Pro N 9

Probable root cause: In OSDCloud.ps1, the following code section should be hit, but isn't (console output 'Adjusting selected ImageIndex by -1' is not displayed):

if (($OSLicense -eq 'Retail') -and ($Global:OSDCloud.WindowsImageCount -eq 9)) { if ($OSEdition -eq 'Home Single Language') { Write-Warning "$((Get-Date).ToString('yyyy-MM-dd-HHmmss')) OSDCloud Failed" Write-Warning "This ESD does not contain a Home Single Edition Index" Write-Warning "Restart OSDCloud and select a different Edition" Start-Sleep -Seconds 86400 Stop-Computer -Force Exit } if ($OSEdition -notmatch 'Home') { Write-DarkGrayHost "This ESD does not contain a Home Single Edition Index" Write-DarkGrayHost "Adjusting selected ImageIndex by -1" $Global:OSDCloud.OSImageIndex = ($Global:OSDCloud.OSImageIndex - 1) Write-DarkGrayHost "ImageIndex: $($Global:OSDCloud.OSImageIndex)" } }

This probably happens because the $OSLicense variable is $null. I'm suspecting this has something to do with the introduction of the OSD.json file in newer versions of the OSD module, where the OSLicense is now referenced as OSActivation. I've included the OSDCloud.json and Deploy-OSDCloud.log, which shows the $null value for the OSLicense property and the 9 value for the OSImageIndex propery in the $global:OSDCloud variable.

The last OSD version I know for sure didn't have this issue, is 23.1.10.1

OSDCloud.zip 2023-04-20-163954-Deploy-OSDCloud.log

OSDeploy commented 1 year ago

I'm working on this

OSDeploy commented 1 year ago

This will be corrected in the next update ... apologies

image

OSDeploy commented 1 year ago

This has been resolved in the latest release https://www.powershellgallery.com/packages/OSD/23.4.25.1