debloat_configure_updates

Path: /debloat_components/debloat_configure_updates.py

Overview

This component detects the Windows edition and applies the corresponding Windows Update policy by executing the appropriate PowerShell script.

Purpose & Use Cases

Automate configuration of Windows Update settings in enterprise or professional environments to enforce update policies.

Enable standardized update behavior on Home editions by applying default policy scripts.

Dependencies

Python winreg module for registry access

utilities.util_powershell_handler for executing PowerShell scripts

utilities.util_logger for logging informational and error messages

utilities.util_error_popup for displaying errors in a GUI popup

Configuration & Parameters

Parameter Type Description Default
None N/A No user-configurable parameters; script auto-selects policy changer based on edition N/A

Usage Example

python debloat_configure_updates.py

Behavior & Implementation

On execution, the script reads the ProductName value from HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion to determine the Windows edition. If the edition contains “Professional”, “Pro”, or “Enterprise”, it selects update_policy_changer_pro.ps1; otherwise it uses update_policy_changer.ps1. It then invokes run_powershell_script to apply the update policy.

Error Handling

Exceptions reading the registry or running the PowerShell script are caught and logged at ERROR level. A GUI error popup is displayed via show_error_popup, and the script exits with a non-zero status on failure.

Security Considerations

Requires administrative privileges to modify update policies. Ensure scripts are sourced from trusted locations to avoid arbitrary code execution.

Logging

Uses util_logger at INFO and ERROR levels. Example messages:

INFO: Detected product name: Windows 10 Pro

INFO: Executing PowerShell script: update_policy_changer_pro.ps1

ERROR: ✖ Failed to execute update_policy_changer_pro.ps1: [error details]

Testing & Validation

Run manually on both Pro/Enterprise and Home editions. Verify the appropriate PowerShell script executes without errors and that update policies are applied as expected. Unit tests can mock winreg and run_powershell_script to simulate behavior.

Author

Author: Raven Development Team