mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-08-07 04:26:23 -05:00
[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 <101426328+CodingWonders@users.noreply.github.com> * 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 <101426328+CodingWonders@users.noreply.github.com> * modified: functions/microwin/Invoke-Microwin.ps1 modified: xaml/inputXML.xaml --------- Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com> * 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 <101426328+CodingWonders@users.noreply.github.com> * 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
This commit is contained in:
@ -58,6 +58,9 @@ public class PowerManagement {
|
||||
$injectDrivers = $sync.MicrowinInjectDrivers.IsChecked
|
||||
$importDrivers = $sync.MicrowinImportDrivers.IsChecked
|
||||
|
||||
$WPBT = $sync.MicroWinWPBT.IsChecked
|
||||
$unsupported = $sync.MicroWinUnsupported.IsChecked
|
||||
|
||||
$importVirtIO = $sync.MicrowinCopyVirtIO.IsChecked
|
||||
|
||||
$mountDir = $sync.MicrowinMountDir.Text
|
||||
@ -66,7 +69,12 @@ public class PowerManagement {
|
||||
# Detect if the Windows image is an ESD file and convert it to WIM
|
||||
if (-not (Test-Path -Path "$mountDir\sources\install.wim" -PathType Leaf) -and (Test-Path -Path "$mountDir\sources\install.esd" -PathType Leaf)) {
|
||||
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..."
|
||||
Export-WindowsImage -SourceImagePath $mountDir\sources\install.esd -SourceIndex $index -DestinationImagePath $mountDir\sources\install.wim -CompressionType "Max"
|
||||
try {
|
||||
Export-WindowsImage -SourceImagePath "$mountDir\sources\install.esd" -SourceIndex $index -DestinationImagePath "$mountDir\sources\install.wim" -CompressionType "Max"
|
||||
} catch {
|
||||
# Usually the case if it can't find unattend.dll on the host system. Guys, fix your corrupt messes that are your installations!
|
||||
dism /english /export-image /sourceimagefile="$mountDir\sources\install.esd" /sourceindex=$index /destinationimagefile="$mountDir\sources\install.wim" /compress:max
|
||||
}
|
||||
if ($?) {
|
||||
Remove-Item -Path "$mountDir\sources\install.esd" -Force
|
||||
# Since we've already exported the image index we wanted, switch to the first one
|
||||
@ -166,6 +174,25 @@ public class PowerManagement {
|
||||
}
|
||||
}
|
||||
|
||||
if ($WPBT) {
|
||||
Write-Host "Disabling WPBT Execution"
|
||||
reg load HKLM\zSYSTEM "$($scratchDir)\Windows\System32\config\SYSTEM"
|
||||
reg add "HKLM\zSYSTEM\ControlSet001\Control\Session Manager" /v DisableWpbtExecution /t REG_DWORD /d 1 /f
|
||||
reg unload HKLM\zSYSTEM
|
||||
}
|
||||
|
||||
if ($unsupported) {
|
||||
Write-Host "Bypassing system requirements (locally)"
|
||||
reg add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d 0 /f
|
||||
reg add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassCPUCheck" /t REG_DWORD /d 1 /f
|
||||
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassRAMCheck" /t REG_DWORD /d 1 /f
|
||||
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassSecureBootCheck" /t REG_DWORD /d 1 /f
|
||||
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassStorageCheck" /t REG_DWORD /d 1 /f
|
||||
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d 1 /f
|
||||
reg add "HKLM\SYSTEM\Setup\MoSetup" /v "AllowUpgradesWithUnsupportedTPMOrCPU" /t REG_DWORD /d 1 /f
|
||||
}
|
||||
|
||||
if ($importVirtIO) {
|
||||
Write-Host "Copying VirtIO drivers..."
|
||||
Microwin-CopyVirtIO
|
||||
@ -221,6 +248,20 @@ public class PowerManagement {
|
||||
|
||||
Write-Host "Create unattend.xml"
|
||||
|
||||
if (($sync.MicrowinAutoConfigBox.Text -ne "") -and (Test-Path "$($sync.MicrowinAutoConfigBox.Text)"))
|
||||
{
|
||||
try
|
||||
{
|
||||
Write-Host "A configuration file has been specified. Copying to WIM file..."
|
||||
Copy-Item "$($sync.MicrowinAutoConfigBox.Text)" "$($scratchDir)\winutil-config.json"
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host "The config file could not be copied. Continuing without it..."
|
||||
}
|
||||
}
|
||||
|
||||
# Create unattended answer file with user information - Check condition to learn more about this functionality
|
||||
if ($sync.MicrowinUserName.Text -eq "")
|
||||
{
|
||||
Microwin-NewUnattend -userName "User"
|
||||
@ -242,7 +283,6 @@ public class PowerManagement {
|
||||
Copy-Item "$env:temp\unattend.xml" "$($scratchDir)\Windows\Panther\unattend.xml" -force
|
||||
New-Item -ItemType Directory -Force -Path "$($scratchDir)\Windows\System32\Sysprep"
|
||||
Copy-Item "$env:temp\unattend.xml" "$($scratchDir)\Windows\System32\Sysprep\unattend.xml" -force
|
||||
Copy-Item "$env:temp\unattend.xml" "$($scratchDir)\unattend.xml" -force
|
||||
Write-Host "Done Copy unattend.xml"
|
||||
|
||||
Write-Host "Create FirstRun"
|
||||
@ -277,7 +317,6 @@ public class PowerManagement {
|
||||
reg add "HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Chat" /v ChatIcon /t REG_DWORD /d 2 /f >$null 2>&1
|
||||
reg add "HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f >$null 2>&1
|
||||
reg query "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" >$null 2>&1
|
||||
# Write-Host Error code $LASTEXITCODE
|
||||
Write-Host "Done disabling Teams"
|
||||
|
||||
Write-Host "Fix Windows Volume Mixer Issue"
|
||||
@ -304,11 +343,6 @@ public class PowerManagement {
|
||||
'CrossDeviceUpdate'
|
||||
) | ForEach-Object {
|
||||
Write-Host "Removing Windows Expedited App: $_"
|
||||
|
||||
# Copied here After Installation (Online)
|
||||
# reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\$_" /f | Out-Null
|
||||
|
||||
# When in Offline Image
|
||||
reg delete "HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\$_" /f | Out-Null
|
||||
}
|
||||
}
|
||||
@ -316,7 +350,6 @@ public class PowerManagement {
|
||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
|
||||
Write-Host "Setting all services to start manually"
|
||||
reg add "HKLM\zSOFTWARE\CurrentControlSet\Services" /v Start /t REG_DWORD /d 3 /f
|
||||
# Write-Host $LASTEXITCODE
|
||||
|
||||
Write-Host "Enabling Local Accounts on OOBE"
|
||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v "BypassNRO" /t REG_DWORD /d "1" /f
|
||||
@ -371,7 +404,12 @@ public class PowerManagement {
|
||||
try {
|
||||
|
||||
Write-Host "Exporting image into $mountDir\sources\install2.wim"
|
||||
Export-WindowsImage -SourceImagePath "$mountDir\sources\install.wim" -SourceIndex $index -DestinationImagePath "$mountDir\sources\install2.wim" -CompressionType "Max"
|
||||
try {
|
||||
Export-WindowsImage -SourceImagePath "$mountDir\sources\install.wim" -SourceIndex $index -DestinationImagePath "$mountDir\sources\install2.wim" -CompressionType "Max"
|
||||
} catch {
|
||||
# Usually the case if it can't find unattend.dll on the host system. Guys, fix your corrupt messes that are your installations!
|
||||
dism /english /export-image /sourceimagefile="$mountDir\sources\install.wim" /sourceindex=$index /destinationimagefile="$mountDir\sources\install2.wim" /compress:max
|
||||
}
|
||||
Write-Host "Remove old '$mountDir\sources\install.wim' and rename $mountDir\sources\install2.wim"
|
||||
Remove-Item "$mountDir\sources\install.wim"
|
||||
Rename-Item "$mountDir\sources\install2.wim" "$mountDir\sources\install.wim"
|
||||
@ -385,6 +423,20 @@ public class PowerManagement {
|
||||
}
|
||||
Write-Host "Windows image completed. Continuing with boot.wim."
|
||||
|
||||
$esd = $sync.MicroWinESD.IsChecked
|
||||
if ($esd) {
|
||||
Write-Host "Converting install image to ESD."
|
||||
try {
|
||||
Export-WindowsImage -SourceImagePath "$mountDir\sources\install.wim" -SourceIndex $index -DestinationImagePath "$mountDir\sources\install.esd" -CompressionType "Recovery"
|
||||
Remove-Item "$mountDir\sources\install.wim"
|
||||
Write-Host "Converted install image to ESD."
|
||||
} catch {
|
||||
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
|
||||
Remove-Item "$mountDir\sources\install.wim"
|
||||
Write-Host "Converted install image to ESD."
|
||||
}
|
||||
}
|
||||
|
||||
# Next step boot image
|
||||
Write-Host "Mounting boot image $mountDir\sources\boot.wim into $scratchDir"
|
||||
Mount-WindowsImage -ImagePath "$mountDir\sources\boot.wim" -Index 2 -Path "$scratchDir"
|
||||
@ -481,6 +533,7 @@ public class PowerManagement {
|
||||
Write-Host "Reason: $($exitCode.Message)"
|
||||
Invoke-MicrowinBusyInfo -action "warning" -message $exitCode.Message
|
||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||
[System.Windows.MessageBox]::Show("MicroWin failed to make the ISO.", "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||
} catch {
|
||||
# Could not get error description from Windows APIs
|
||||
}
|
||||
@ -488,7 +541,6 @@ public class PowerManagement {
|
||||
|
||||
Toggle-MicrowinPanel 1
|
||||
|
||||
#$sync.MicrowinFinalIsoLocation.Text = "$env:temp\microwin.iso"
|
||||
$sync.MicrowinFinalIsoLocation.Text = "$($SaveDialog.FileName)"
|
||||
# Allow the machine to sleep again (optional)
|
||||
[PowerManagement]::SetThreadExecutionState(0)
|
||||
|
@ -85,6 +85,14 @@ function Microwin-NewFirstRun {
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.StartupApp" /v Enabled /t REG_DWORD /d 0 /f
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SkyDrive.Desktop" /f
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SkyDrive.Desktop" /v Enabled /t REG_DWORD /d 0 /f
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.AccountHealth" /f
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.AccountHealth" /v Enabled /t REG_DWORD /d 0 /f
|
||||
|
||||
if (Test-Path -Path "$env:HOMEDRIVE\winutil-config.json")
|
||||
{
|
||||
Write-Host "Configuration file detected. Applying..."
|
||||
iex "& { $(irm christitus.com/win) } -Config `"$env:HOMEDRIVE\winutil-config.json`" -Run"
|
||||
}
|
||||
|
||||
'@
|
||||
$firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force
|
||||
|
24
functions/public/Invoke-AutoConfigDialog.ps1
Normal file
24
functions/public/Invoke-AutoConfigDialog.ps1
Normal file
@ -0,0 +1,24 @@
|
||||
function Invoke-AutoConfigDialog {
|
||||
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Sets the automatic configuration file based on a specified JSON file
|
||||
|
||||
#>
|
||||
|
||||
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
|
||||
$OFD = New-Object System.Windows.Forms.OpenFileDialog
|
||||
$OFD.Filter = "JSON Files (*.json)|*.json"
|
||||
$OFD.ShowDialog()
|
||||
|
||||
if (($OFD.FileName -eq "") -and ($sync.MicrowinAutoConfigBox.Text -eq ""))
|
||||
{
|
||||
Write-Host "No automatic config file has been selected. Continuing without one..."
|
||||
return
|
||||
}
|
||||
elseif ($OFD.FileName -ne "")
|
||||
{
|
||||
$sync.MicrowinAutoConfigBox.Text = "$($OFD.FileName)"
|
||||
}
|
||||
}
|
@ -64,5 +64,6 @@ function Invoke-WPFButton {
|
||||
"WPFWinUtilSSHServer" {Invoke-WPFSSHServer}
|
||||
"WPFselectedAppsButton" {$sync.selectedAppsPopup.IsOpen = -not $sync.selectedAppsPopup.IsOpen}
|
||||
"WPFMicrowinPanelBack" {Toggle-MicrowinPanel 1}
|
||||
"MicrowinAutoConfigBtn" {Invoke-AutoConfigDialog}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user