microsoft / microsoft/winget-cli
Winget.exe access denied & HRESULT: 0x80073CF0, Package could not be opened
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 26.4k
- Forks
- 1.8k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Description
On newly deployed Windows machine, I've been using a script to deploy Winget so it would be always available for the user/machine. The script is here: https://github.com/Romanitho/Winget-Install but in the nutshell it installs it like this:
if ([version]$WinGetAvailableVersion -gt [version]$WinGetInstalledVersion) {
Write-ToLog "-> Downloading Winget v$WinGetAvailableVersion"
$WingetURL = "https://github.com/microsoft/winget-cli/releases/download/v$WinGetAvailableVersion/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
$WingetInstaller = "$env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
Invoke-RestMethod -Uri $WingetURL -OutFile $WingetInstaller
try {
Write-ToLog "-> Installing Winget v$WinGetAvailableVersion"
Add-AppxProvisionedPackage -Online -PackagePath $WingetInstaller -SkipLicense | Out-Null
Write-ToLog "-> Winget installed." "Green"
}
catch {
Write-ToLog "-> Failed to install Winget!" "Red"
}
Remove-Item -Path $WingetInstaller -Force
}
On freshly deployed devices I had no issues so far and everything worked fine. SYSTEM and USER context, but now we are using DELL service to have these laptops pre-deployed with so-called DELL READYIMAGE and I'm running into an issue where USER-context installations doesn't work anymore. SYSTEM-context still works fine.
Symptoms
- When launching winget through CMD (both admin and non-admin) it responds with "winget is not recognized as an internal or external command"
- When trying to run winget directly
& "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.27.209.0_x64__8wekyb3d8bbwe\winget.exe"getting "Access Denied"
- When trying to re-install Winget manually or with install-winget.ps1 script getting: "HRESULT: 0x80073CF0, Package could not be opened
When looking the logs for this activity it shows this:
Tried to open DesktopInstaller folder by getting the location with:
Get-AppxPackage Microsoft.DesktopAppInstaller | Select Name, PackageFullName
Then, launching all sorts of exes: AppInstaller, AuthenticationManager, winget.exe, WindowsPackageManagerServer all of them report: "You may not have the appropriate permissions*
Text files: XML, jsons can be opened with notepad. In fact, I can even open the exeecutables via Notepad, too.
Checked the ACL's for winget.exe on a good machine and the bad machine but they seem to be exactly the same...
- Installing Appinstaller from Windows Store doesn't do anything but it shows that it's present:
-
There is no Winget found in User profile:
LOCALAPPDATA\Microsoft\WindowsApps\Desktop... -
Tried to take ownership of Microsoft.DesktopAppInstaller folder with
takeown /F "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.27.209.0_x64__8wekyb3d8bbwe" /A /R /D Yand then adding myself to the ACL withicacls "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.27.209.0_x64__8wekyb3d8bbwe" /grant "$env:USERDOMAIN\$env:USERNAME:F" /T`
Then I can finally call winget.exe from this path. Which doesn't make sense to me as to why do I need to overtake this folder at all.
When I've been comparing the permissions between good machine and the bad machine, they seemed to be the same...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Winget-Install script and the Add-AppxProvisionedPackage call, then compare its user-context behavior with the working SYSTEM-context installation. Reproduce the access-denied and 0x80073CF0 symptoms using install-winget.ps1 and inspect the WindowsApps permissions and deployment logs; done means identifying a reproducible cause and documenting a verified user-context resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100