Raphire / Win11Debloat

A simple, easy to use PowerShell script to remove pre-installed apps from Windows, disable telemetry, remove Bing from Windows search as well as perform various other changes to declutter and improve your Windows experience. This script works for both Windows 10 and Windows 11.
MIT License
14.2k stars 614 forks source link

Errors on Custom Mode; Manual App Selection #79

Closed assassinscrack closed 4 months ago

assassinscrack commented 4 months ago

Description: I am getting a load of errors when trying to enter the app selection in Custom Mode. Additionally, no window opens up for actual selection.

Steps to reproduce the behavior:

  1. Open 'Run.bat'
  2. Select '(2) Custom Mode then (3) Manual App Selection'
  3. Wait for 'Errors'

Expected behavior: I expected a window popping up to show me the options.

Additional context: I have ran this tool as Administrator on my only user account after a fresh restart. Added screenshots for more info.

Screenshot0 Screenshot1

Raphire commented 4 months ago

Heya,

You're seeing this issue due to security policies that are applied to your system. This feature specifically is called constrained language mode, it restricts the methods and functions that can be used by powershell scripts. More information here: https://devblogs.microsoft.com/powershell/powershell-constrained-language-mode/

I'm not sure what specifically locked down powershell in your case. Usually this policy is applied by organizations through something like AppLocker. More information about this here: https://learn.microsoft.com/en-us/windows/security/application-security/application-control/windows-defender-application-control/applocker/applocker-overview

I will update the script to more gracefully handle these kind of situations, but I think it's unlikely the script can be updated to work with these heavy restrictions to powershell's capabilities.

assassinscrack commented 4 months ago

Thanks for the info. After some research on this I managed to find the problem. There was a "__PSLockDownPolicy" set under Environment Variables; System Variables. Once I deleted this I was able to use the script without issue.