From 0ee9972edf95d6755f4aac9eda0765a82a8fa494 Mon Sep 17 00:00:00 2001 From: MyDrift Date: Mon, 19 Aug 2024 06:15:06 +0200 Subject: [PATCH] little fix --- .../private/Invoke-WinUtilDownloadISO.ps1 | 28 +++++++++++++++++++ functions/public/Invoke-WPFGetIso.ps1 | 7 +---- scripts/main.ps1 | 8 ++++-- 3 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 functions/private/Invoke-WinUtilDownloadISO.ps1 diff --git a/functions/private/Invoke-WinUtilDownloadISO.ps1 b/functions/private/Invoke-WinUtilDownloadISO.ps1 new file mode 100644 index 00000000..fa3d21f7 --- /dev/null +++ b/functions/private/Invoke-WinUtilDownloadISO.ps1 @@ -0,0 +1,28 @@ +function Invoke-WinUtilDownloadISO { + # https://github.com/AveYo/MediaCreationTool.bat/blob/main/MediaCreationTool.bat + + ::# show more responsive MCT + PRE pseudo-menu dialog or separate choice dialog instances if either MCT or PRE are set + if "%MCT%%PRE%"=="" call :choices2 MCT "%VERSIONS%" %dV% "MCT Version" PRE "%PRESETS%" %dP% "MCT Preset" 11 white 0x005a9e 320 + if %MCT%0 lss 1 if %PRE%0 gtr 1 call :choices MCT "%VERSIONS%" %dV% "MCT Version" 11 white 0x005a9e 320 + if %MCT%0 gtr 1 if %PRE%0 lss 1 call :choices PRE "%PRESETS%" %dP% "MCT Preset" 11 white 0x005a9e 320 + if %MCT%0 gtr 1 if %PRE%0 lss 1 goto choice-0 = cancel + goto choice-%MCT% + + :choice-17 + set "VER=22631" & set "VID=11_23H2" & set "CB=22631.2861.231204-0538.23H2_ni_release_svc_refresh" & set "CT=2023/12/" & set "CC=2.0" + set "CAB=https://download.microsoft.com/download/6/2/b/62b47bc5-1b28-4bfa-9422-e7a098d326d4/products_win11_20231208.cab" + set "EXE=https://download.microsoft.com/download/e/c/d/ecd532eb-bed0-465a-9b7a-330066bec3ce/MediaCreationTool_Win11_23H2.exe" + goto process ::# refreshed 22621 base with integrated 23H2 enablement package + + :choice-16 + set "VER=22621" & set "VID=11_22H2" & set "CB=22621.1702.230505-1222.ni_release_svc_refresh" & set "CT=2023/05/" & set "CC=2.0" + set "CAB=https://download.microsoft.com/download/b/1/9/b19bd7fd-78c4-4f88-8c40-3e52aee143c2/products_win11_20230510.cab.cab" + set "EXE=https://software-static.download.prss.microsoft.com/dbazure/988969d5-f34g-4e03-ac9d-1f9786c66749/mediacreationtool.exe" + goto process ::# windows 11 22H2 + + :choice-15 + set "VER=22000" & set "VID=11_21H2" & set "CB=22000.318.211104-1236.co_release_svc_refresh" & set "CT=2021/11/" & set "CC=2.0" + set "CAB=https://download.microsoft.com/download/1/b/4/1b4e06e2-767a-4c9a-9899-230fe94ba530/products_Win11_20211115.cab" + set "EXE=https://software-download.microsoft.com/download/pr/888969d5-f34g-4e03-ac9d-1f9786c69161/MediaCreationToolW11.exe" + goto process ::# windows 11 : usability and ui downgrade, and even more ChrEdge bloat (but somewhat snappier multitasking) +} \ No newline at end of file diff --git a/functions/public/Invoke-WPFGetIso.ps1 b/functions/public/Invoke-WPFGetIso.ps1 index e82c5e0f..72e87ff5 100644 --- a/functions/public/Invoke-WPFGetIso.ps1 +++ b/functions/public/Invoke-WPFGetIso.ps1 @@ -78,12 +78,7 @@ function Invoke-WPFGetIso { } } elseif ($sync["ISOoption1"].IsChecked) { # Auto download newest ISO - $Win = "Win11" - $Rel = "23H2" - $Outpath = "$env:TEMP\$Win" + "_$Rel.iso" - Invoke-Webrequest -Uri $finalurl -OutFile $Outpath - $filePath = $Outpath - + $filePath = Invoke-WinUtilDownloadISO } Write-Host "File path $($filePath)" diff --git a/scripts/main.ps1 b/scripts/main.ps1 index fc0b9f75..592944a9 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -356,16 +356,18 @@ Add-Type @" }) +$locale = (Get-Culture).Name + $sync["ISORelease"].Items.Add("23H2") $sync["ISORelease"].Items.Add("22H2") $sync["ISORelease"].Items.Add("21H2") $sync["ISORelease"].SelectedItem = "23H2" -$sync["ISOLanguage"].Items.Add((Get-Culture).Name) -if ((Get-Culture).Name -ne "en-US") { +$sync["ISOLanguage"].Items.Add($locale) +if ($locale -ne "en-US") { $sync["ISOLanguage"].Items.Add("en-US") } -$sync["ISOLanguage"].SelectedItem = (Get-Culture).Name +$sync["ISOLanguage"].SelectedItem = $locale $sync["ISOArchitecture"].Items.Add("64-bit") $sync["ISOArchitecture"].Items.Add("86-bit")