Description
Describe the bug
My App is Packaged MSIX.
I use PackageManager API to install/uninstall the app in custom action of MSI (wix project)
I also test PackageManager API in console app, and got same result.
For simulate local system account of MSI, I use psexec -i -s cmd.exe.
First Install app and provision for all user.
Then use RemovePackageAsync with RemoveForAllUsers flag to remove app not clear user app data.
And then reinstall the package again, old app user data still exist.
And then do provision again for all user, the app will disappear (be removed).
Steps to reproduce the bug
I have have two users UserA and UserB
UserA and UserB are logged on, and current switch to UserA.
For each step check installed user (by Local System Account)
auto users = packageManager.FindUsers(packageFullName);
print UserSecurityId() for each users
Step 1. Install package (by UserA Account)
const auto deploymentOperation{ packageManager.AddPackageAsync(packageUri, std::move(dependencyPackageUris), DeploymentOptions::None) };
deploymentOperation.get();
Installed users:
S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXXX-1001 // User A
Step 2. Provision package (by Local System Account)
const auto provisionOperation{ packageManager.ProvisionPackageForAllUsersAsync(packageFamilyName.c_str()) };
provisionOperation.get();
Check app is installed in UserA and UserB and app can be launch. And then close app for each user.
Finally switch to UserA.
Installed users:
S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXXX-1001 // User A
S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXXX-1002 // User B
Step 3. DeprovisionPackage (optional) (by Local System Account)
const auto deprovisionOperation{ packageManager.DeprovisionPackageForAllUsersAsync(packageFamilyName.c_str()) };
deprovisionOperation.get();
Installed users:
S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXXX-1001 // User A
S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXXX-1002 // User B
Step 4. Remove package for all users (by Local System Account)
const auto removeOperation{ packageManager.RemovePackageAsync(packageFullName, RemovalOptions::RemoveForAllUsers) };
removeOperation.get();
The user app data folder still exist for each user:
%UserProfile%\AppData\Local\Packages\%PackageFamilyName%
Installed users:
No
Step 5. do "Step 1" Install package (by UserA Account)
After app installed, the app in UserA, app can access old app data.
Installed users:
S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXXX-1001 // User A
Step 6. do "Step 2." Provision package (by Local System Account)
The app will be removed.
Installed users:
S-1-5-18
Expected behavior
RemovePackageAsync with RemoveForAllUsers can remove app for all users and clear user data for all users.
Screenshots
No response
NuGet package version
1.1.3
Packaging type
Packaged (MSIX)
Windows version
Windows 11 version 21H2 (22000)
IDE
Visual Studio 2019
Additional context
No response