Eli123
Eli123

Reputation: 21

Updating a software from the MS Store using the msixBundle file with a powershell command

I need to prepare a powershell script, that I can use after installing Windows. The script will install basic programs with Winget. The problem is, that after an installation of Windows, the App Installer isn't updated, so the Winget can't work.

In order to solve the problem, I wrote a PowerShell code that downloads an already updated file for the App installer from my Google Drive, and installs it. The problem is, that because the App installer is already installed at my PC, and it only needs an update, I receive an error. (If I install the file manually it works)

I decided to delete the folders in the path "C:\Program Files\WindowsApps" of the app installer, and then I saw that it's not possible to delete the files because the access is denied.

I'm looking for a way to take ownership of the files with a powershell command. I tried several commands and still when I tried to delete it, it returnes access denied. For example:

takeown /f "C:\Program Files\WindowsApps" /a /r 

returned an error.

  1. How can I update the existing the App Installer using the msixbundle file with a PowerShell command?
  2. If it's not possible, how can I delete these files without an error?

Thanks a lot!!!

This is my code:

takeown /f “C:\Program Files\WindowsApps” /r
takeown /f “C:\Program Files\WindowsApps” /a /r
takeown /f “C:\Program Files\WindowsApps” /r /d y
icacls “C:\Program Files\WindowsApps” /grant administrators:F /t
Get-Childitem -Path "C:\Program Files\WindowsApps" -Recurse | Where-Object {$_.Name -ilike "*DesktopAppInstaller*"} | Remove-Item -recurse -force
New-Item "C:\new1" -itemType Directory
$URL=The link to Google Drive is here.
$PATH="C:\new1\AppInstaller1.msixbundle"
Invoke-WebRequest -URI $URL -OutFile $Path
Add-AppPackage -path "C:\new1\AppInstaller1.msixbundle"
Remove-Item "C:\new1" -Recurse

the installing error message:

Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF3, 
Package failed updates, dependency or conflict validation.
Windows cannot install package Microsoft.DesktopAppInstaller_1.18.2691.0_x64__8wekyb3d8bbwe 
because this package depends on a framework that could not be found.
Provide the framework "Microsoft.UI.Xaml.2.7" published by
"CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", 
with neutral or x64 processor architecture and minimum version 7.2109.13004.0, 
along with this package to install.
The frameworks with name "Microsoft.UI.Xaml.2.7" currently installed are: {}
NOTE: For additional information, look for [ActivityId] 10f677b2-f6bc-0000-971e-f710bcf6d801 in the Event Log or use
the command line Get-AppPackageLog -ActivityID 10f677b2-f6bc-0000-971e-f710bcf6d801
At line:1 char:1
Add-AppxPackage -path "C:\n1\DesktopAppInstaller.Msixbundle"

   CategoryInfo          : WriteError: (C:\n1\DesktopAppInstaller.Msixbundle:String) [Add-AppxPackage], IOException
    FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

Upvotes: 1

Views: 1273

Answers (1)

Eli123
Eli123

Reputation: 21

I found the solution! On the download page of the AppInstaller at https://store.rg-adguard.net
(package: https://www.microsoft.com/store/productId/9NBLGGH4NNS1) There are the missing packages for installation.
I downloaded and installed them and then everything worked. (no need to delete the old installation).
Thanks to @mklement0 for helping me reach a solution!

Upvotes: 1

Related Questions