Skip to content

Commit

Permalink
Fixes Raphire#191: Skip Explorer restart when in sysprep mode
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
helge000 committed Feb 10, 2025
1 parent 0355653 commit f1869b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Win11Debloat.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -547,14 +547,14 @@ function RegImport {
function RestartExplorer {
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 and not not in sysprep mode.
# 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) -and (-not $global:Params.ContainsKey("Sysprep")) )
{
Stop-Process -processName: Explorer -Force
}
else {
Write-Warning "Unable to restart Windows Explorer process, please manually restart your PC to apply all changes."
Write-Warning "Not restarting Windows Explorer process, please manually restart your PC to apply all changes."
}
}

Expand Down

0 comments on commit f1869b1

Please sign in to comment.