Skip to content

Commit 8622892

Browse files
[MicroWin] June-August 2025 Update (#3417)
* Disable "Microsoft account" notification source * [WinPE] Remove driver addition block for WinPE WE DO NOT TOUCH THE DRIVERS IN WinPE. There are reports of people getting "Install driver to show hardware" screens all over this repository, and on Discord; and the less drivers we touch in WinPE, the better. Drivers can still be added to Preinstallation Environments in the following ways: - Using the driver installation screens - Firing up "drvload.exe <driver>" in cmd * [Fix] Added fallback for DISM export command This is a port of the fix in #3305 * [Cleanup] Removed some comments that no longer make sense * [Fix] Same DISM export image fallback fix * Merge branch 'main' into microwin-202506 * [Fix] Improve UI consistency for instructions Fixes #3394 * Merge branch 'main' into microwin-202506 * [Unattended answer file] Remove it from drive root The answer file, on the drive root, is not necessary for us to apply it. In fact, it's not even used there * Merge branch 'main' into microwin-202506 * [MicroWin] June-August 2025 Update (#3) -- Contributions from Callum * Allow people without compatible hardware or a USB to use MicroWin. * Update functions/microwin/Microwin-NewUnattend.ps1 Co-authored-by: CodingWonders <[email protected]> * Update Invoke-Microwin.ps1 * Update Microwin-NewUnattend.ps1 * Update Microwin-NewUnattend.ps1 * Add error pop up if ISO Creation fails. Issue 2653 * Add Disable WPBT Execution to MicroWin. * Update functions/microwin/Invoke-Microwin.ps1 Co-authored-by: CodingWonders <[email protected]> * modified: functions/microwin/Invoke-Microwin.ps1 modified: xaml/inputXML.xaml --------- Co-authored-by: CodingWonders <[email protected]> * Add conversion to ESD (#4) * Add conversion to ESD Issue - #3450 * Update Invoke-Microwin.ps1 Added quotes to the file paths. Put all the arguments in 1 string (as that also works fine) --------- Co-authored-by: CodingWonders <[email protected]> * Update MicroWin contributor list * Merge branch 'main' into microwin-202506 * Merge branch 'main' into microwin-202506 * [MicroWin] Add automatic configuration settings Originally implemented in #2618. Adapted to follow the new file structure. And it works. Though there are issues that will be detailed very soon * [Fix] Fixed typos, updated descriptions * Re-add WinPE driver addition We're not yet sure if that is the actual problem of missing storage controllers. Logs can tell us more about this. Maybe for a future PR? * [Fix/WPBT] Add spaces to reg key path Avoid REG failure * [Fix/XAML] Fix word wrapping issue for checkboxes
1 parent af09bcb commit 8622892

File tree

6 files changed

+129
-13
lines changed

6 files changed

+129
-13
lines changed

functions/microwin/Invoke-Microwin.ps1

Lines changed: 63 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public class PowerManagement {
5858
$injectDrivers = $sync.MicrowinInjectDrivers.IsChecked
5959
$importDrivers = $sync.MicrowinImportDrivers.IsChecked
6060

61+
$WPBT = $sync.MicroWinWPBT.IsChecked
62+
$unsupported = $sync.MicroWinUnsupported.IsChecked
63+
6164
$importVirtIO = $sync.MicrowinCopyVirtIO.IsChecked
6265

6366
$mountDir = $sync.MicrowinMountDir.Text
@@ -66,7 +69,12 @@ public class PowerManagement {
6669
# Detect if the Windows image is an ESD file and convert it to WIM
6770
if (-not (Test-Path -Path "$mountDir\sources\install.wim" -PathType Leaf) -and (Test-Path -Path "$mountDir\sources\install.esd" -PathType Leaf)) {
6871
Write-Host "Exporting Windows image to a WIM file, keeping the index we want to work on. This can take several minutes, depending on the performance of your computer..."
69-
Export-WindowsImage -SourceImagePath $mountDir\sources\install.esd -SourceIndex $index -DestinationImagePath $mountDir\sources\install.wim -CompressionType "Max"
72+
try {
73+
Export-WindowsImage -SourceImagePath "$mountDir\sources\install.esd" -SourceIndex $index -DestinationImagePath "$mountDir\sources\install.wim" -CompressionType "Max"
74+
} catch {
75+
# Usually the case if it can't find unattend.dll on the host system. Guys, fix your corrupt messes that are your installations!
76+
dism /english /export-image /sourceimagefile="$mountDir\sources\install.esd" /sourceindex=$index /destinationimagefile="$mountDir\sources\install.wim" /compress:max
77+
}
7078
if ($?) {
7179
Remove-Item -Path "$mountDir\sources\install.esd" -Force
7280
# Since we've already exported the image index we wanted, switch to the first one
@@ -166,6 +174,25 @@ public class PowerManagement {
166174
}
167175
}
168176

177+
if ($WPBT) {
178+
Write-Host "Disabling WPBT Execution"
179+
reg load HKLM\zSYSTEM "$($scratchDir)\Windows\System32\config\SYSTEM"
180+
reg add "HKLM\zSYSTEM\ControlSet001\Control\Session Manager" /v DisableWpbtExecution /t REG_DWORD /d 1 /f
181+
reg unload HKLM\zSYSTEM
182+
}
183+
184+
if ($unsupported) {
185+
Write-Host "Bypassing system requirements (locally)"
186+
reg add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d 0 /f
187+
reg add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d 0 /f
188+
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassCPUCheck" /t REG_DWORD /d 1 /f
189+
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassRAMCheck" /t REG_DWORD /d 1 /f
190+
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassSecureBootCheck" /t REG_DWORD /d 1 /f
191+
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassStorageCheck" /t REG_DWORD /d 1 /f
192+
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d 1 /f
193+
reg add "HKLM\SYSTEM\Setup\MoSetup" /v "AllowUpgradesWithUnsupportedTPMOrCPU" /t REG_DWORD /d 1 /f
194+
}
195+
169196
if ($importVirtIO) {
170197
Write-Host "Copying VirtIO drivers..."
171198
Microwin-CopyVirtIO
@@ -221,6 +248,20 @@ public class PowerManagement {
221248

222249
Write-Host "Create unattend.xml"
223250

251+
if (($sync.MicrowinAutoConfigBox.Text -ne "") -and (Test-Path "$($sync.MicrowinAutoConfigBox.Text)"))
252+
{
253+
try
254+
{
255+
Write-Host "A configuration file has been specified. Copying to WIM file..."
256+
Copy-Item "$($sync.MicrowinAutoConfigBox.Text)" "$($scratchDir)\winutil-config.json"
257+
}
258+
catch
259+
{
260+
Write-Host "The config file could not be copied. Continuing without it..."
261+
}
262+
}
263+
264+
# Create unattended answer file with user information - Check condition to learn more about this functionality
224265
if ($sync.MicrowinUserName.Text -eq "")
225266
{
226267
Microwin-NewUnattend -userName "User"
@@ -242,7 +283,6 @@ public class PowerManagement {
242283
Copy-Item "$env:temp\unattend.xml" "$($scratchDir)\Windows\Panther\unattend.xml" -force
243284
New-Item -ItemType Directory -Force -Path "$($scratchDir)\Windows\System32\Sysprep"
244285
Copy-Item "$env:temp\unattend.xml" "$($scratchDir)\Windows\System32\Sysprep\unattend.xml" -force
245-
Copy-Item "$env:temp\unattend.xml" "$($scratchDir)\unattend.xml" -force
246286
Write-Host "Done Copy unattend.xml"
247287

248288
Write-Host "Create FirstRun"
@@ -277,7 +317,6 @@ public class PowerManagement {
277317
reg add "HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Chat" /v ChatIcon /t REG_DWORD /d 2 /f >$null 2>&1
278318
reg add "HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f >$null 2>&1
279319
reg query "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" >$null 2>&1
280-
# Write-Host Error code $LASTEXITCODE
281320
Write-Host "Done disabling Teams"
282321

283322
Write-Host "Fix Windows Volume Mixer Issue"
@@ -304,19 +343,13 @@ public class PowerManagement {
304343
'CrossDeviceUpdate'
305344
) | ForEach-Object {
306345
Write-Host "Removing Windows Expedited App: $_"
307-
308-
# Copied here After Installation (Online)
309-
# reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\$_" /f | Out-Null
310-
311-
# When in Offline Image
312346
reg delete "HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\$_" /f | Out-Null
313347
}
314348
}
315349

316350
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
317351
Write-Host "Setting all services to start manually"
318352
reg add "HKLM\zSOFTWARE\CurrentControlSet\Services" /v Start /t REG_DWORD /d 3 /f
319-
# Write-Host $LASTEXITCODE
320353

321354
Write-Host "Enabling Local Accounts on OOBE"
322355
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v "BypassNRO" /t REG_DWORD /d "1" /f
@@ -371,7 +404,12 @@ public class PowerManagement {
371404
try {
372405

373406
Write-Host "Exporting image into $mountDir\sources\install2.wim"
374-
Export-WindowsImage -SourceImagePath "$mountDir\sources\install.wim" -SourceIndex $index -DestinationImagePath "$mountDir\sources\install2.wim" -CompressionType "Max"
407+
try {
408+
Export-WindowsImage -SourceImagePath "$mountDir\sources\install.wim" -SourceIndex $index -DestinationImagePath "$mountDir\sources\install2.wim" -CompressionType "Max"
409+
} catch {
410+
# Usually the case if it can't find unattend.dll on the host system. Guys, fix your corrupt messes that are your installations!
411+
dism /english /export-image /sourceimagefile="$mountDir\sources\install.wim" /sourceindex=$index /destinationimagefile="$mountDir\sources\install2.wim" /compress:max
412+
}
375413
Write-Host "Remove old '$mountDir\sources\install.wim' and rename $mountDir\sources\install2.wim"
376414
Remove-Item "$mountDir\sources\install.wim"
377415
Rename-Item "$mountDir\sources\install2.wim" "$mountDir\sources\install.wim"
@@ -385,6 +423,20 @@ public class PowerManagement {
385423
}
386424
Write-Host "Windows image completed. Continuing with boot.wim."
387425

426+
$esd = $sync.MicroWinESD.IsChecked
427+
if ($esd) {
428+
Write-Host "Converting install image to ESD."
429+
try {
430+
Export-WindowsImage -SourceImagePath "$mountDir\sources\install.wim" -SourceIndex $index -DestinationImagePath "$mountDir\sources\install.esd" -CompressionType "Recovery"
431+
Remove-Item "$mountDir\sources\install.wim"
432+
Write-Host "Converted install image to ESD."
433+
} catch {
434+
Start-Process -FilePath "$env:SystemRoot\System32\dism.exe" -ArgumentList "/export-image /sourceimagefile:`"$mountDir\sources\install.wim`" /sourceindex:1 /destinationimagefile:`"$mountDir\sources\install.esd`" /compress:recovery" -Wait -NoNewWindow
435+
Remove-Item "$mountDir\sources\install.wim"
436+
Write-Host "Converted install image to ESD."
437+
}
438+
}
439+
388440
# Next step boot image
389441
Write-Host "Mounting boot image $mountDir\sources\boot.wim into $scratchDir"
390442
Mount-WindowsImage -ImagePath "$mountDir\sources\boot.wim" -Index 2 -Path "$scratchDir"
@@ -481,14 +533,14 @@ public class PowerManagement {
481533
Write-Host "Reason: $($exitCode.Message)"
482534
Invoke-MicrowinBusyInfo -action "warning" -message $exitCode.Message
483535
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
536+
[System.Windows.MessageBox]::Show("MicroWin failed to make the ISO.", "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
484537
} catch {
485538
# Could not get error description from Windows APIs
486539
}
487540
}
488541

489542
Toggle-MicrowinPanel 1
490543

491-
#$sync.MicrowinFinalIsoLocation.Text = "$env:temp\microwin.iso"
492544
$sync.MicrowinFinalIsoLocation.Text = "$($SaveDialog.FileName)"
493545
# Allow the machine to sleep again (optional)
494546
[PowerManagement]::SetThreadExecutionState(0)

functions/microwin/Microwin-NewFirstRun.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ function Microwin-NewFirstRun {
8585
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.StartupApp" /v Enabled /t REG_DWORD /d 0 /f
8686
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SkyDrive.Desktop" /f
8787
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SkyDrive.Desktop" /v Enabled /t REG_DWORD /d 0 /f
88+
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.AccountHealth" /f
89+
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.AccountHealth" /v Enabled /t REG_DWORD /d 0 /f
90+
91+
if (Test-Path -Path "$env:HOMEDRIVE\winutil-config.json")
92+
{
93+
Write-Host "Configuration file detected. Applying..."
94+
iex "& { $(irm christitus.com/win) } -Config `"$env:HOMEDRIVE\winutil-config.json`" -Run"
95+
}
8896
8997
'@
9098
$firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
function Invoke-AutoConfigDialog {
2+
3+
<#
4+
5+
.SYNOPSIS
6+
Sets the automatic configuration file based on a specified JSON file
7+
8+
#>
9+
10+
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
11+
$OFD = New-Object System.Windows.Forms.OpenFileDialog
12+
$OFD.Filter = "JSON Files (*.json)|*.json"
13+
$OFD.ShowDialog()
14+
15+
if (($OFD.FileName -eq "") -and ($sync.MicrowinAutoConfigBox.Text -eq ""))
16+
{
17+
Write-Host "No automatic config file has been selected. Continuing without one..."
18+
return
19+
}
20+
elseif ($OFD.FileName -ne "")
21+
{
22+
$sync.MicrowinAutoConfigBox.Text = "$($OFD.FileName)"
23+
}
24+
}

functions/public/Invoke-WPFButton.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,6 @@ function Invoke-WPFButton {
6464
"WPFWinUtilSSHServer" {Invoke-WPFSSHServer}
6565
"WPFselectedAppsButton" {$sync.selectedAppsPopup.IsOpen = -not $sync.selectedAppsPopup.IsOpen}
6666
"WPFMicrowinPanelBack" {Toggle-MicrowinPanel 1}
67+
"MicrowinAutoConfigBtn" {Invoke-AutoConfigDialog}
6768
}
6869
}

scripts/main.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ $sync["AboutMenuItem"].Add_Click({
488488
Author : <a href="https://github.com/ChrisTitusTech">@christitustech</a>
489489
UI : <a href="https://github.com/MyDrift-user">@MyDrift-user</a>, <a href="https://github.com/Marterich">@Marterich</a>
490490
Runspace : <a href="https://github.com/DeveloperDurp">@DeveloperDurp</a>, <a href="https://github.com/Marterich">@Marterich</a>
491-
MicroWin : <a href="https://github.com/KonTy">@KonTy</a>, <a href="https://github.com/CodingWonders">@CodingWonders</a>
491+
MicroWin : <a href="https://github.com/KonTy">@KonTy</a>, <a href="https://github.com/CodingWonders">@CodingWonders</a>, <a href="https://github.com/Real-MullaC">@Real-MullaC</a>
492492
GitHub : <a href="https://github.com/ChrisTitusTech/winutil">ChrisTitusTech/winutil</a>
493493
Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sync.version)">$($sync.version)</a>
494494
"@

xaml/inputXML.xaml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,37 @@
14591459
Foreground="{DynamicResource LabelboxForegroundColor}"
14601460
/>
14611461
<Rectangle Fill="{DynamicResource MainForegroundColor}" Height="2" HorizontalAlignment="Stretch" Margin="0,10,0,10"/>
1462+
<TextBlock Margin="6" Padding="1" TextWrapping="Wrap"><Bold>Tweaks (leave empty for default settings)</Bold></TextBlock>
1463+
<CheckBox Name="MicroWinWPBT" Margin="{DynamicResource MicrowinCheckBoxMargin}" IsChecked="False" ToolTip="If enabled then allows your computer vendor to execute a program each time it boots. It enables computer vendors to force install anti-theft software, software drivers, or a software program conveniently. This could also be a security risk."><AccessText TextWrapping="Wrap" Text="Disable Windows Platform Binary Table (WPBT) (ADVANCED TWEAK)" /></CheckBox>
1464+
<CheckBox Name="MicroWinUnsupported" Margin="{DynamicResource MicrowinCheckBoxMargin}" IsChecked="False" ToolTip="If enabled then it will allow you to upgrade your PC to Windows 11 if your PC does not support Windows 11 yet. This is good for if you do not have a USB and want to upgrade to Windows 11 on unsupported hardware."><AccessText TextWrapping="Wrap" Text="Allow this PC to upgrade to Windows 11" /></CheckBox>
1465+
<CheckBox Name="MicroWinESD" Margin="{DynamicResource MicrowinCheckBoxMargin}" IsChecked="False" ToolTip="The ESD file format compresses the installation image even further, therefore reducing ISO file sizes a little more. Select this if you have a small USB."><AccessText TextWrapping="Wrap" Text="Convert this image to ESD (This will take longer)" /></CheckBox>
1466+
<TextBlock Margin="6" Padding="1" TextWrapping="Wrap">WinUtil configuration file (JSON)</TextBlock>
1467+
<Grid>
1468+
<Grid.ColumnDefinitions>
1469+
<ColumnDefinition Width="*" /> <!-- Takes the remaining space -->
1470+
<ColumnDefinition Width="32" /> <!-- Fixed width for Button -->
1471+
</Grid.ColumnDefinitions>
1472+
<TextBox Name="MicrowinAutoConfigBox" Background="Transparent" BorderBrush="{DynamicResource MainForegroundColor}"
1473+
Text=""
1474+
Margin="2"
1475+
IsReadOnly="False"
1476+
Grid.Column="0"
1477+
ToolTip="Path of your configuration file"
1478+
VerticalAlignment="Center"
1479+
Foreground="{DynamicResource LabelboxForegroundColor}">
1480+
</TextBox>
1481+
<Button Name="MicrowinAutoConfigBtn"
1482+
Width="Auto"
1483+
Height="Auto"
1484+
Grid.Column="1"
1485+
Margin="2"
1486+
Padding="1" VerticalAlignment="Center">
1487+
<Button.Content>
1488+
...
1489+
</Button.Content>
1490+
</Button>
1491+
</Grid>
1492+
<Rectangle Fill="{DynamicResource MainForegroundColor}" Height="2" HorizontalAlignment="Stretch" Margin="0,10,0,10"/>
14621493
<Button Name="WPFMicrowin" Content="Start the process" Margin="2" Padding="15"/>
14631494
</StackPanel>
14641495
<StackPanel HorizontalAlignment="Left" SnapsToDevicePixels="True" Margin="1" Visibility="Collapsed">
@@ -1527,7 +1558,7 @@
15271558
May take several minutes to process the ISO depending on your machine and connection <LineBreak/>
15281559
- Put it somewhere on the C:\ drive so it is easily accessible <LineBreak/>
15291560
- Launch WinUtil and MicroWin <LineBreak/>
1530-
- Click on the "Select Windows ISO" button and wait for WinUtil to process the image <LineBreak/>
1561+
- Click on the "Get Windows ISO" button and wait for WinUtil to process the image <LineBreak/>
15311562
It will be processed and unpacked which may take some time <LineBreak/>
15321563
- Once complete, choose which Windows flavor you want to base your image on <LineBreak/>
15331564
- Click the "Start Process" button <LineBreak/>

0 commit comments

Comments
 (0)