You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit improves the revert script for store apps to handle
scenarios where `Get-AppxPackage` returns multiple packages. Instead of
relying on a single package result, the script now iterates over all
found packages and attempts installation using the `AppxManifest.xml`
for each. This ensures that even if multiple versions or instances of a
package are found, the script will robustly handle and attempt to install
each one until successful.
Other changes:
- Add better message with suggestion if the revert code fails, as
discussed in #270.
- Improve robustness of finding manifest path by using `Join-Path`
instead of basic string concatenation. This resolves wrong paths being
built due to missing `\` in file path.
- Add check for null or empty `InstallLocation` before accessing
manifest path. It prevents errors when accessing `AppxManifest.xml`,
enhancing script robustness and reliability.
- Improve error handling in manifest file existence check with try-catch
block to catch and log exceptions, ensuring uninterrupted script
execution in edge cases such as when the script lacks access to read
the directory.
- Add verification of package installation before attempting to install
the package for increased robustness.
- Add documentation for revertCode.
# This script attempts to reinstall the app that was just uninstalled, if necessary.
10250
-
# The app's package family name is constructed using its name and publisher ID.
10251
-
# Package Family Name is: `<name>_<publisherid>`
10252
-
# Learn more about package identity: https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/package-identity-overview#publisher-id (https://archive.ph/Sx4JC)
10250
+
# Re-installation strategy:
10251
+
# 1. Attempt to locate the package from another user's installation:
10252
+
# - Utilizes the `Get-AppxPackage` command with the `-AllUsers` flag to search across all user installations.
10253
+
# - Iterates through the results to locate the manifest file required for re-installation.
10254
+
# 2. Attempt to locate the package from the system installation:
10255
+
# - Utilizes the `Get-AppxPackage` command with `-RegisterByFamilyName` to search for the manifest file in the system installation.
10256
+
# - The app's package family name is constructed using its name and publisher ID.
10257
+
# Package Family Name is: `<name>_<publisherid>`
10258
+
# Learn more about package identity: https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/package-identity-overview#publisher-id (https://archive.ph/Sx4JC)
10259
+
# - Based on tests, Windows attempts to locate the file in the installation location of the package.
10260
+
# This location can be identified using commands such as `(Get-AppxPackage -AllUsers 'Windows.PrintDialog').InstallLocation`.
10261
+
# Possible installation locations include:
10262
+
# - `%WINDIR%\SystemApps\{PackageFamilyName}` (for system apps)
0 commit comments