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
This commit is contained in:
Daniel Helgenberger
2025-02-12 13:07:44 +01:00
committed by GitHub
parent 035565324d
commit 907221b643

View File

@@ -545,12 +545,15 @@ function RegImport {
# Restart the Windows Explorer process # Restart the Windows Explorer process
function RestartExplorer { function RestartExplorer {
if ($global:Params.ContainsKey("Sysprep")) {
return
}
Write-Output "> Restarting Windows Explorer process to apply all changes... (This may cause some flickering)" 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 # 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 Stop-Process -processName: Explorer -Force
} }
else { else {