Compare commits

..

No commits in common. "b5c80bfbd2d27a663d2cb6400c14798d8340691c" and "125e78be962c2fc8bcff12f9d47806967c9d5835" have entirely different histories.

View File

@ -261,24 +261,32 @@ 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")
$sync.MicrowinWindowsFlavors.SelectedIndex = 0
Write-Host "Finding suitable Pro edition. This can take some time. Do note that this is an automatic process that might not select the edition you want."
if ((Get-WindowsImage -ImagePath $wimFile -Index $_.ImageIndex).EditionId -eq "Professional") {
# We have found the Pro edition
$sync.MicrowinWindowsFlavors.SelectedIndex = $_.ImageIndex - 1
# Check if the image name contains 'Pro'
if ($imageName -like "*Pro*" -and !$proeditionfound) {
$proEditionIndex = $imageIdx
$proeditionfound = $true
}
}
# 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)'....."