Skip to content

Conversation

@emtuls
Copy link
Member

@emtuls emtuls commented Aug 2, 2025

Created a function to handle start menu cleanup in debloat.vm to eliminate code duplication making the script more maintainable, addressing #1462 (review).

Fixed errors in win11.xml and win11arm.xml registry key modifications and refactored the VM-Apply-Configuration function to include granular blocks within each processing loop. This prevents a single configuration error, such as an invalid registry type, from halting the entire script, closing #1479

Fixed logging issues with common.vm, closing #1478

emtuls added 2 commits August 1, 2025 23:02
Refactors  to use a new  function.

This change eliminates code duplication between the  and  sections, making the script more maintainable.
Refactored the  function to include granular  blocks within each processing loop. This prevents a single configuration error, such as an invalid registry type, from halting the entire script.

The change ensures that the script continues to process subsequent items in the XML configuration file, while still logging a specific error message for any individual item that fails.
@emtuls emtuls self-assigned this Aug 2, 2025
@emtuls emtuls added 🐛 bug Something isn't working 💎 enhancement It is working, but it could be better 🌀 FLARE-VM A package or feature to be used by FLARE-VM labels Aug 2, 2025
@emtuls emtuls requested a review from Ana06 August 2, 2025 00:29
if ($config.config."registry-items"."registry-item") {
VM-Write-Log "INFO" "Processing registry items..."
$config.config."registry-items"."registry-item" | ForEach-Object {
try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the try-catch duplication, as we have a try-catch already inside the function, that can cause the Failed to update registry item error message to be duplicated. The try-catch inside the called function does not apply if the arguments for the function are wrong (as it happened with the provided type argument). Should we remove the try-catch inside the function and leave it here?

Also, I think VM-Update-Registry-Value continues to fail in Windows 11 here is because Set-ItemProperty does not have a Type argument.The extra argument was ignored in Windows 10, but causes an error in Windows 11.

Set-ItemProperty -Path $path -Name $value -Value $validatedData -Type $type -Force | Out-Null

<registry-item name="Disable Microsoft Connectivity Test (msftconnecttest.com)" path="HKLM:\SYSTEM\CurrentControlSet\services\NlaSvc\Parameters\Internet" value="EnableActiveProbing" type="DWord" data="0" />
<registry-item name="Disable Resetbase" path="HKLM\Software\Microsoft\Windows\CurrentVersion\SideBySide\Configuration" value="DisableResetbase" type="REG_DWORD" data="0"/>
<registry-item name="Disable LetAppsActivateWithVoice" path="HKLM\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" value="LetAppsActivateWithVoice" type="REG_DWORD" data="2"/>
<registry-item name="Disable Resetbase" path="HKLM\Software\Microsoft\Windows\CurrentVersion\SideBySide\Configuration" value="DisableResetbase" type="DWord" data="0"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] even correcting the code, it seems all these registry configurations are not applied in my Windows 11 VM. Are they applied for you @emtuls or are they only Windows 11 specific and we could remove them here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working 🌀 FLARE-VM A package or feature to be used by FLARE-VM 💎 enhancement It is working, but it could be better

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants