Skip to content

Commit

Permalink
Fixes #191: Skip Explorer restart when in sysprep mode (#192)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
helge000 authored Feb 12, 2025
1 parent 0355653 commit 907221b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Win11Debloat.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 907221b

Please sign in to comment.