From 907221b643bff0f26ef60a5aeb429de1a4debc75 Mon Sep 17 00:00:00 2001 From: Daniel Helgenberger Date: Wed, 12 Feb 2025 13:07:44 +0100 Subject: [PATCH] Fixes #191: Skip Explorer restart when in sysprep mode (#192) * Fixes #191: Skip Explorer restart when in sysprep mode - Since Settings are applied to Default Profile, calling RestartExplorer does nothing - RestartExplorer also terminates all processes witch might have called WinDebloat in the first place --- Win11Debloat.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Win11Debloat.ps1 b/Win11Debloat.ps1 index 42a6e74..a191ebe 100644 --- a/Win11Debloat.ps1 +++ b/Win11Debloat.ps1 @@ -545,12 +545,15 @@ function RegImport { # Restart the Windows Explorer process function RestartExplorer { + if ($global:Params.ContainsKey("Sysprep")) { + return + } + Write-Output "> Restarting Windows Explorer process to apply all changes... (This may cause some flickering)" - # Only restart if the powershell process matches the OS architecture + # Only restart if the powershell process matches the OS architecture. # Restarting explorer from a 32bit Powershell window will fail on a 64bit OS - if ([Environment]::Is64BitProcess -eq [Environment]::Is64BitOperatingSystem) - { + if ([Environment]::Is64BitProcess -eq [Environment]::Is64BitOperatingSystem) { Stop-Process -processName: Explorer -Force } else {