win: prevent updates from reinstalling apps #260

This commit addresses the issue of unwanted applications being
reinstalled during a Windows update. By adding a specific registry
entry, this commit ensures that Windows apps, once removed, do not
return with subsequent updates.

This change ensures more control over the applications present on a
Windows system, particularly after an update, enhancing user experience
and systeam cleanliness.
This commit is contained in:
undergroundwires
2023-10-23 16:52:52 +02:00
parent d6da406c61
commit 8570b02dde

View File

@@ -9967,6 +9967,7 @@ functions:
- name: packageName - name: packageName
- name: publisherId - name: publisherId
call: call:
-
function: RunPowerShell function: RunPowerShell
parameters: parameters:
code: Get-AppxPackage '{{ $packageName }}' | Remove-AppxPackage code: Get-AppxPackage '{{ $packageName }}' | Remove-AppxPackage
@@ -10008,6 +10009,21 @@ functions:
} }
# If all methods fail # If all methods fail
throw "Unable to install `"$packageName`". Please check the provided details and try again." throw "Unable to install `"$packageName`". Please check the provided details and try again."
-
function: RunInlineCode
# Prevent applications from being reinstalled during a Windows update.
# For more information:
# - https://learn.microsoft.com/en-us/windows/application-management/remove-provisioned-apps-during-update#create-registry-keys-for-deprovisioned-apps
# - Archived: https://archive.ph/04108, https://web.archive.org/web/20231023131048/https://learn.microsoft.com/en-us/windows/application-management/remove-provisioned-apps-during-update#create-registry-keys-for-deprovisioned-apps
# - https://learn.microsoft.com/en-us/mem/configmgr/osd/understand/in-place-upgrade-recommendations#remove-default-apps
# - Archived: https://archive.ph/I7Dwc, https://web.archive.org/web/20231023132613/https://learn.microsoft.com/en-us/mem/configmgr/osd/understand/in-place-upgrade-recommendations#remove-default-apps
parameters:
code: |-
:: Mark the application as deprovisioned to prevent it from reinstalling during Windows updates.
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Deprovisioned\{{ $packageName }}_{{ $publisherId }}" /f
revertCode: |-
:: Remove the deprovisioned status to allow the application to reinstall during Windows updates.
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Deprovisioned\{{ $packageName }}_{{ $publisherId }}" /f 2>nul
- -
name: UninstallSystemApp name: UninstallSystemApp
parameters: parameters: