debloat_execute_external_scripts

Path: /debloat_components/debloat_execute_external_scripts.py

Overview

This script orchestrates the execution of two external Windows debloating utilities by downloading and running the ChrisTitusTech WinUtil script and the Raphi Win11Debloat script via remote PowerShell commands.

Purpose & Use Cases

Automate the removal of unwanted Windows components and applications according to a predefined configuration file.

Apply additional system tweaks such as disabling telemetry, removing gaming apps, and adjusting UI settings through the Raphi Win11Debloat utility.

Dependencies

utilities.util_logger for structured logging.

utilities.util_powershell_handler for running PowerShell commands.

utilities.util_error_popup for displaying error dialogs to the user.

Configuration & Parameters

Parameter Type Description Default
None N/A This script does not accept any command-line parameters. N/A

Usage Example

python debloat_execute_external_scripts.py

Behavior & Implementation

On startup, the script determines its base installation path and locates the WinUtil configuration file at configs/default.json. It then constructs a remote PowerShell command to invoke the ChrisTitusTech WinUtil script with the specified configuration, monitoring its output until it reports completion. Next, it builds a second PowerShell command with a collection of flags to run the Raphi Win11Debloat script. Both commands are executed via run_powershell_command, and their success or failure is logged.

Error Handling

If the configuration file is missing or any PowerShell command fails, the script logs an ERROR message, displays a blocking error popup using show_error_popup, and exits with a non-zero status code.

Security Considerations

This component downloads and executes remote scripts via PowerShell, which may pose security risks if the external sources are compromised. It should be run in a trusted environment with administrative privileges. Configuration files are loaded without validation, so ensure configs/default.json is from a trusted source.

Logging

Uses the logger at INFO level for operational messages (e.g., script start, successful executions) and ERROR level for failures (e.g., missing config, command errors).

Testing & Validation

To test, run the script in a Windows VM with PowerShell available and verify that each step completes without error. Mock or stub run_powershell_command in unit tests to simulate success and failure scenarios.

Author

Author: Raven Development Team