From b8718b6508570c3686c7f7ae370583cd417aded7 Mon Sep 17 00:00:00 2001 From: CodingWonders <101426328+CodingWonders@users.noreply.github.com> Date: Fri, 2 Feb 2024 21:56:09 +0100 Subject: [PATCH] Improve detection for Pro editions of Windows (#1539) * Update applications.json Fake app add made by linux fanboy * Compile Winutil * Update files - Add detections for whether the image to be processed by MicroWin is Windows 10 or later - Add procedure to clear the indexes ComboBox (WinForms term) every time an ISO is specified * Update screen-install.png (#1464) * Compile Winutil * Improve detection for Professional editions --------- Co-authored-by: Chris Titus Co-authored-by: ChrisTitusTech Co-authored-by: Samq64 <81489795+Samq64@users.noreply.github.com> Co-authored-by: Chris Titus --- functions/public/Invoke-WPFGetIso.ps1 | 10 +++++++++- winutil.ps1 | 14 +++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/functions/public/Invoke-WPFGetIso.ps1 b/functions/public/Invoke-WPFGetIso.ps1 index 570cad74b4..6a2fa50ccd 100644 --- a/functions/public/Invoke-WPFGetIso.ps1 +++ b/functions/public/Invoke-WPFGetIso.ps1 @@ -173,7 +173,15 @@ function Invoke-WPFGetIso { $imageName = $_.ImageName $sync.MicrowinWindowsFlavors.Items.Add("$imageIdx : $imageName") } - $sync.MicrowinWindowsFlavors.SelectedIndex = 5 + $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." + Get-WindowsImage -ImagePath $wimFile | ForEach-Object { + if ((Get-WindowsImage -ImagePath $wimFile -Index $_.ImageIndex).EditionId -eq "Professional") + { + # We have found the Pro edition + $sync.MicrowinWindowsFlavors.SelectedIndex = $_.ImageIndex - 1 + } + } Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage Write-Host "Selected value '$($sync.MicrowinWindowsFlavors.SelectedValue)'....." diff --git a/winutil.ps1 b/winutil.ps1 index 4dc821c7b3..1b55e78cad 100644 --- a/winutil.ps1 +++ b/winutil.ps1 @@ -10,7 +10,7 @@ Author : Chris Titus @christitustech Runspace Author: @DeveloperDurp GitHub : https://github.com/ChrisTitusTech - Version : 24.02.01 + Version : 24.02.02 #> param ( [switch]$Debug, @@ -47,7 +47,7 @@ Add-Type -AssemblyName System.Windows.Forms # Variable to sync between runspaces $sync = [Hashtable]::Synchronized(@{}) $sync.PSScriptRoot = $PSScriptRoot -$sync.version = "24.02.01" +$sync.version = "24.02.02" $sync.configs = @{} $sync.ProcessRunning = $false @@ -3053,7 +3053,15 @@ function Invoke-WPFGetIso { $imageName = $_.ImageName $sync.MicrowinWindowsFlavors.Items.Add("$imageIdx : $imageName") } - $sync.MicrowinWindowsFlavors.SelectedIndex = 5 + $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." + Get-WindowsImage -ImagePath $wimFile | ForEach-Object { + if ((Get-WindowsImage -ImagePath $wimFile -Index $_.ImageIndex).EditionId -eq "Professional") + { + # We have found the Pro edition + $sync.MicrowinWindowsFlavors.SelectedIndex = $_.ImageIndex - 1 + } + } Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage Write-Host "Selected value '$($sync.MicrowinWindowsFlavors.SelectedValue)'....."