Skip to content

Commit

Permalink
restore usage of EditionID
Browse files Browse the repository at this point in the history
TODO: fetch EditionID foreach index without looping Get-WindowsImage
  • Loading branch information
MyDrift-user committed Nov 6, 2024
1 parent 125e78b commit f3bffa9
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions functions/public/Invoke-WPFGetIso.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -261,32 +261,21 @@ function Invoke-WPFGetIso {
}
$sync.MicrowinWindowsFlavors.Items.Clear()

# Store the results of Get-WindowsImage in a variable
$images = Get-WindowsImage -ImagePath $wimFile

$proEditionIndex = -1
$proeditionfound = $false

# Populate the list of Windows flavors and find the Pro edition
$images | ForEach-Object {
$imageIdx = $_.ImageIndex
$imageName = $_.ImageName

$sync.MicrowinWindowsFlavors.Items.Add("$imageIdx : $imageName")

# Check if the image name contains 'Pro'
if ($imageName -like "*Pro*" -and !$proeditionfound) {
$proEditionIndex = $imageIdx
$proeditionfound = $true
if ((Get-WindowsImage -ImagePath $wimFile -Index $_.ImageIndex).EditionId -eq "Professional") {
# We have found the Pro edition
$sync.MicrowinWindowsFlavors.SelectedIndex = $_.ImageIndex - 1
}
}

# Set the selected index to the Pro edition if found, otherwise default to the first item
if ($proEditionIndex -ne -1) {
$sync.MicrowinWindowsFlavors.SelectedIndex = $proEditionIndex - 1
} else {
$sync.MicrowinWindowsFlavors.SelectedIndex = 0
}

Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage
Write-Host "Selected value '$($sync.MicrowinWindowsFlavors.SelectedValue)'....."

Expand Down

0 comments on commit f3bffa9

Please sign in to comment.