I've been trying to programmatically uninstall a Windows Store App (iTunes).I used below commands :
Remove-AppxPackage -Package AppleInc.iTunes_12092.6.37131.0_x64__nzyj5cx40ttqa
and as admin
Remove-AppxPackage -Package AppleInc.iTunes_12092.6.37131.0_x64__nzyj5cx40ttqa -AllUsers
The commands executes fine without errors and the apps disappear in start menu, and Add/Remove programs. But when I start the iTunes installation (desktop version, not store) after those commands execution, it complains that a store version is still installed.
If I go to the "C:\\Program Files\\WindowsApps\\AppleInc.iTunes_12075.9.34012.0_x64__nzyj5cx40ttqa" there are still files in there.
However, if I remove the iTunes store version via the Add/Remove instead of command line, it works fine and then I can install iTunes standard.
One important point is that for some users, the command just work fine and I can install iTunes.
My question is, Am I missing something? Is there a cache that needs to be cleaned ? Some other commands (than Remove-AppxPackage) that need to be executed after above commands to fully uninstall this Windows Store app?
Try something like this:
$AppList = "AppleInc.iTunes"
ForEach ($App in $AppList) {
$PackageFullName = (Get-AppxPackage $App).PackageFullName
$ProPackageFullName = (Get-AppxProvisionedPackage -online | where {$_.Displayname -eq $App}).PackageName
write-host $PackageFullName
Write-Host $ProPackageFullName
if ($PackageFullName) {
Write-Host "Removing Package: $App"
remove-AppxPackage -package $PackageFullName
}
else{
Write-Host "Unable to find package: $App"
}
if ($ProPackageFullName) {
Write-Host "Removing Provisioned Package: $ProPackageFullName"
Remove-AppxProvisionedPackage -online -packagename $ProPackageFullName
}
else {
Write-Host "Unable to find provisioned package: $App"
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.