mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 22:55:52 -06:00
restore usage of EditionID
TODO: fetch EditionID foreach index without looping Get-WindowsImage
This commit is contained in:
parent
125e78be96
commit
f3bffa9952
@ -261,32 +261,21 @@ function Invoke-WPFGetIso {
|
|||||||
}
|
}
|
||||||
$sync.MicrowinWindowsFlavors.Items.Clear()
|
$sync.MicrowinWindowsFlavors.Items.Clear()
|
||||||
|
|
||||||
# Store the results of Get-WindowsImage in a variable
|
|
||||||
$images = Get-WindowsImage -ImagePath $wimFile
|
$images = Get-WindowsImage -ImagePath $wimFile
|
||||||
|
|
||||||
$proEditionIndex = -1
|
|
||||||
$proeditionfound = $false
|
|
||||||
|
|
||||||
# Populate the list of Windows flavors and find the Pro edition
|
# Populate the list of Windows flavors and find the Pro edition
|
||||||
$images | ForEach-Object {
|
$images | ForEach-Object {
|
||||||
$imageIdx = $_.ImageIndex
|
$imageIdx = $_.ImageIndex
|
||||||
$imageName = $_.ImageName
|
$imageName = $_.ImageName
|
||||||
|
|
||||||
$sync.MicrowinWindowsFlavors.Items.Add("$imageIdx : $imageName")
|
$sync.MicrowinWindowsFlavors.Items.Add("$imageIdx : $imageName")
|
||||||
|
|
||||||
# Check if the image name contains 'Pro'
|
if ((Get-WindowsImage -ImagePath $wimFile -Index $_.ImageIndex).EditionId -eq "Professional") {
|
||||||
if ($imageName -like "*Pro*" -and !$proeditionfound) {
|
# We have found the Pro edition
|
||||||
$proEditionIndex = $imageIdx
|
$sync.MicrowinWindowsFlavors.SelectedIndex = $_.ImageIndex - 1
|
||||||
$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
|
Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage
|
||||||
Write-Host "Selected value '$($sync.MicrowinWindowsFlavors.SelectedValue)'....."
|
Write-Host "Selected value '$($sync.MicrowinWindowsFlavors.SelectedValue)'....."
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user