winget-install icon indicating copy to clipboard operation
winget-install copied to clipboard

[Bug]: WS2019 After winget upgrade Microsoft.DesktopAppInstaller Microsoft.AppInstaller from 1.24.25200.0 to 1.25.340.0. winget fails

Open StefanReppien opened this issue 1 year ago • 13 comments

Describe the feature or improvement you're requesting

After winget update run on Windows Server 2019, winget commad is not found next time.

PS C:\Users\x.y> winget update SearchName SearchId SearchVersion AvailableHeader SearchSource

Mozilla Firefox (x64 de) Mozilla.Firefox 135.0 136.0.1 winget Microsoft.DesktopAppInstaller Microsoft.AppInstaller 1.24.25200.0 1.25.340.0 winget AvailableUpgrades PS C:\Users\x.y> winget update -r -h SearchName SearchId SearchVersion AvailableHeader SearchSource

Mozilla Firefox (x64 de) Mozilla.Firefox 135.0 136.0.1 winget Microsoft.DesktopAppInstaller Microsoft.AppInstaller 1.24.25200.0 1.25.340.0 winget AvailableUpgrades

DependenciesFlowInstall PackageRequiresDependencies

  • PackageDependencies Microsoft.VCLibs.Desktop.14 [>= 14.0.33728.0] Microsoft.UI.Xaml.2.8 [>= 8.2310.30001.0] (1/2) ReportIdentityFound Mozilla Firefox [Mozilla.Firefox] ShowVersion 136.0.1 InstallationDisclaimer1 InstallationDisclaimer2 Downloading https://download-installer.cdn.mozilla.net/pub/firefox/releases/136.0.1/win64/de/Firefox%20Setup%20136.0.1.exe ██████████████████████████████ 67.9 MB / 67.9 MB InstallerHashVerified InstallFlowStartingPackageInstall InstallFlowInstallSuccess

(2/2) ReportIdentityFound App Installer [Microsoft.AppInstaller] ShowVersion 1.25.340.0 InstallationDisclaimer1 InstallationDisclaimer2 (1/2) ReportIdentityFound Microsoft.UI.Xaml [Microsoft.UI.Xaml.2.8] ShowVersion 8.2310.30001.0 InstallationDisclaimer1 InstallationDisclaimer2 Downloading https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx ██████████████████████████████ 4.88 MB / 4.88 MB InstallerHashVerified InstallFlowStartingPackageInstall ██████████████████████████████ 100% InstallFlowInstallSuccess

(2/2) ReportIdentityFound Microsoft Visual C++ 2015 UWP Desktop Runtime Package [Microsoft.VCLibs.Desktop.14] ShowVersion 14.0.33728.0 InstallationDisclaimer1 InstallationDisclaimer2 Downloading https://github.com/microsoft/winget-cli/releases/download/v1.9.25180/DesktopAppInstaller_Dependencies.zip ██████████████████████████████ 47.8 MB / 47.8 MB InstallerHashVerified ExtractingArchive ExtractArchiveSucceeded InstallFlowStartingPackageInstall ██████████████████████████████ 100% InstallFlowInstallSuccess

Downloading https://github.com/microsoft/winget-cli/releases/download/v1.10.340/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle ██████████████████████████████ 215 MB / 215 MB InstallerHashVerified InstallFlowStartingPackageInstall ██████████████████████████████ 100% InstallFlowInstallSuccess

PS C:\Users\x.y> winget winget : Die Benennung "winget" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang. In Zeile:1 Zeichen:1

  • winget
  •   + CategoryInfo          : ObjectNotFound: (winget:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

PS C:\Users\x.y> winget-install winget-install 5.0.6 To check for updates, run winget-install -CheckForUpdate To delay script exit, run winget-install -Wait To force script pausing after execution, run winget-install -NoExit

#################

Prerequisites

#################

Downloading VCLibs... Downloading UI.Xaml...

##########

winget

##########

Downloading winget license... Downloading winget... Installing winget and its dependencies...

###################################################

WARNING! An error occurred during installation!

###################################################

WARNUNG: If messages above don't help and the problem persists, please read the Troubleshooting section of the README: https://github.com/asheroto/winget-install#troubleshooting WARNUNG: Make sure you have the latest version of the script by running this command: winget-install -CheckForUpdate

WARNUNG: Error: Unbekannter Fehler

Rerun the script didn't help. Check on serveral servers.

Additional context

No response

StefanReppien avatar Mar 13 '25 14:03 StefanReppien

same. winget-install fails

m1ker1n avatar Mar 13 '25 15:03 m1ker1n

Can you please run winget-install -debug and share the output?

asheroto avatar Mar 14 '25 21:03 asheroto

Can you please check to see if this version fixes it for you?

https://github.com/asheroto/winget-install/issues/57#issuecomment-2725927047

asheroto avatar Mar 15 '25 11:03 asheroto

Hi ashertoto,

here is the log:

PS C:\Windows\system32> cd C:\temp
PS C:\temp> .\winget-install.ps1 -force winget-install 5.0.7 To check for updates, run winget-install -CheckForUpdate To delay script exit, run winget-install -Wait To force script pausing after execution, run winget-install -NoExit

#################

Prerequisites

#################

Downloading VCLibs... PS C:\temp> .\winget-install.ps1 -force -debug winget-install 5.0.7 To check for updates, run winget-install -CheckForUpdate To delay script exit, run winget-install -Wait To force script pausing after execution, run winget-install -NoExit

#################

Prerequisites

#################

Downloading VCLibs... DEBUG: Downloading VCLibs from https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx to C:\Users\admin\AppData\Local\Temp\0hz5hdl4.zjx

Downloading UI.Xaml... DEBUG: Downloading UI.Xaml from https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx to C:\Users\admin\AppData\Local\Temp\jmy1qvp0.ro4

##########

winget

##########

DEBUG: Getting latest release... Downloading winget license... DEBUG: Downloading winget license from https://github.com/microsoft/winget-cli/releases/download/v1.10.340/4df037184d634a28b13051a797a25a16_License1.xml to C:\Users\admin\AppData\Local\Temp\xyylmued.qo5

Downloading winget... DEBUG: Downloading winget from https://aka.ms/getwinget to C:\Users\admin\AppData\Local\Temp\hux5nk2l.mjm

Installing winget and its dependencies...

###################################################

WARNING! An error occurred during installation!

###################################################

WARNUNG: If messages above don't help and the problem persists, please read the Troubleshooting section of the README: https://github.com/asheroto/winget-install#troubleshooting WARNUNG: Make sure you have the latest version of the script by running this command: winget-install -CheckForUpdate

WARNUNG: Error: Unbekannter Fehler

The are no alias shown.

StefanReppien avatar Mar 15 '25 12:03 StefanReppien

Workaround on Server 2019 in faild state: Admin Powershell:

$FolderPath = "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.25.340.0_x64__8wekyb3d8bbwe"
Write-Debug "Setting full control permissions for the Administrators group on $FolderPath."

# Define the SID for the Administrators group
$administratorsGroupSid = New-Object System.Security.Principal.SecurityIdentifier("S-1-5-32-544")
$administratorsGroup = $administratorsGroupSid.Translate([System.Security.Principal.NTAccount])

# Retrieve the current ACL for the folder
$acl = Get-Acl -Path $FolderPath

# Define the access rule for full control inheritance
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule(
    $administratorsGroup,
    "FullControl",
    "ContainerInherit,ObjectInherit",
    "None",
    "Allow"
)

# Apply the access rule to the ACL and set it on the folder
$acl.SetAccessRule($accessRule)
Set-Acl -Path $FolderPath -AclObject $acl

and

manually change the PATH VAR:

Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\WindowsPowerShell\Scripts;C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.25.340.0_x64__8wekyb3d8bbwe;C:\Users\admin\AppData\Local\Microsoft\WindowsApps

After that, "winget update" works, but winget-install.ps1 -updateshelf and winget-install -force fails furthermore

StefanReppien avatar Mar 15 '25 13:03 StefanReppien

I made some recent changes in version 5.0.7 that may have inadvertently fixed this. Can you check again? If it's not working, can you please run winver and post a screenshot?

If it's still not working, let me know and I will reopen.

asheroto avatar Mar 16 '25 15:03 asheroto

Status on a Windows Server 2019 machine, with winget-install 5.0.5 installed, but did't upgrade [Microsoft.DesktopAppInstaller Microsoft.AppInstaller from 1.24.25200.0 to 1.25.340.0.

Windows PowerShell Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

PS C:\Users\administrator.XYZ> winget-install -UpdateSelf winget-install 5.0.5 Updating script to version 5.0.7... Script updated to version 5.0.7. PS C:\Users\administrator.XYZ> winget-install -force -debug winget-install 5.0.7 To check for updates, run winget-install -CheckForUpdate To delay script exit, run winget-install -Wait To force script pausing after execution, run winget-install -NoExit

#################

Prerequisites

#################

Downloading VCLibs... DEBUG: Downloading VCLibs from https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx to C:\Users\administrator.XYZ\AppData\Local\Temp\2\xd5m2gmk.slj

Downloading UI.Xaml... DEBUG: Downloading UI.Xaml from https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx to C:\Users\administrator.XYZ\AppData\Local\Temp\2\ki04upqi.0mo

##########

winget

##########

DEBUG: Getting latest release... Downloading winget license... DEBUG: Downloading winget license from https://github.com/microsoft/winget-cli/releases/download/v1.10.340/4df037184d634a28b13051a797a25a16_License1.xml to C:\Users\administrator.XYZ\AppData\Local\Temp\2\21nacoke.4my

Downloading winget... DEBUG: Downloading winget from https://aka.ms/getwinget to C:\Users\administrator.XYZ\AppData\Local\Temp\2\wbnbyiy2.0ep

Installing winget and its dependencies... DEBUG: Removing temporary files... DEBUG: File 'C:\Users\administrator.XYZ\AppData\Local\Temp\2\xd5m2gmk.slj' was successfully removed. DEBUG: File 'C:\Users\administrator.XYZ\AppData\Local\Temp\2\ki04upqi.0mo' was successfully removed. DEBUG: File 'C:\Users\administrator.XYZ\AppData\Local\Temp\2\wbnbyiy2.0ep' was successfully removed. DEBUG: File 'C:\Users\administrator.XYZ\AppData\Local\Temp\2\21nacoke.4my' was successfully removed.

#################################################

Visual C++ Redistributable (Server 2019 only)

#################################################

DEBUG: Registry Path: Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X64 DEBUG: Registry Exists: True DEBUG: Major Version: 14 DEBUG: Version: v14.42.34438.00 DEBUG: DLL Path: C:\WINDOWS\system32\concrt140.dll DEBUG: DLL Exists: True Visual C++ Redistributable is already installed. Fixing permissions for winget folder (Server 2019 only)... DEBUG: WinGetFolderPath: C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.25.340.0_x64__8wekyb3d8bbwe DEBUG: Setting full control permissions for the Administrators group on C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.25.340.0_x64__8wekyb3d8bbwe. DEBUG: Adding C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.25.340.0_x64__8wekyb3d8bbwe to the system PATH. DEBUG: Adding C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.25.340.0_x64__8wekyb3d8bbwe to the current process environment PATH. Registering winget...

############

Complete

############

winget installed successfully. Checking if winget is installed and working... winget is installed and working. You can go ahead and use it. PS C:\Users\administrator.XYZ> winget update SearchName SearchId SearchVersion AvailableHeader SearchSource

Microsoft.DesktopAppInstaller Microsoft.AppInstaller 1.24.25200.0 1.25.340.0 winget AvailableUpgrades PS C:\Users\administrator.XYZ> winget update -r -h SearchName SearchId SearchVersion AvailableHeader SearchSource

Microsoft.DesktopAppInstaller Microsoft.AppInstaller 1.24.25200.0 1.25.340.0 winget AvailableUpgrades

DependenciesFlowInstall PackageRequiresDependencies

  • PackageDependencies Microsoft.VCLibs.Desktop.14 [>= 14.0.33728.0] Microsoft.UI.Xaml.2.8 [>= 8.2310.30001.0] (1/1) ReportIdentityFound App Installer [Microsoft.AppInstaller] ShowVersion 1.25.340.0 InstallationDisclaimer1 InstallationDisclaimer2 (1/2) ReportIdentityFound Microsoft.UI.Xaml [Microsoft.UI.Xaml.2.8] ShowVersion 8.2310.30001.0 InstallationDisclaimer1 InstallationDisclaimer2 Downloading https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx ██████████████████████████████ 4.88 MB / 4.88 MB InstallerHashVerified InstallFlowStartingPackageInstall ██████████████████████████████ 100% InstallFlowInstallSuccess

(2/2) ReportIdentityFound Microsoft Visual C++ 2015 UWP Desktop Runtime Package [Microsoft.VCLibs.Desktop.14] ShowVersion 14.0.33728.0 InstallationDisclaimer1 InstallationDisclaimer2 Downloading https://github.com/microsoft/winget-cli/releases/download/v1.9.25180/DesktopAppInstaller_Dependencies.zip ██████████████████████████████ 47.8 MB / 47.8 MB InstallerHashVerified ExtractingArchive ExtractArchiveSucceeded InstallFlowStartingPackageInstall ██████████████████████████████ 100% InstallFlowInstallSuccess

Downloading https://github.com/microsoft/winget-cli/releases/download/v1.10.340/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle ██████████████████████████████ 215 MB / 215 MB InstallerHashVerified InstallFlowStartingPackageInstall ██████████████████████████████ 100% InstallFlowInstallSuccess

PS C:\Users\administrator.XYZ> winget update NoInstalledPackageFound

StefanReppien avatar Mar 18 '25 07:03 StefanReppien

Here the output, on a machine (Windows Server 2019) with the existing problem. Winget-Install script (5.0.7) didn't get installed. Shell is started as administrator.

PS C:\Windows\system32> winget-install -force -debug winget-install 5.0.7 To check for updates, run winget-install -CheckForUpdate To delay script exit, run winget-install -Wait To force script pausing after execution, run winget-install -NoExit

#################

Prerequisites

#################

Downloading VCLibs... DEBUG: Downloading VCLibs from https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx to C:\Users\xxx\AppData\Local\Temp\u5hyzidk.xob

Downloading UI.Xaml... DEBUG: Downloading UI.Xaml from https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx to C:\Users\xxx\AppData\Local\Temp\mrhtnzcs.xin

##########

winget

##########

DEBUG: Getting latest release... Downloading winget license... DEBUG: Downloading winget license from https://github.com/microsoft/winget-cli/releases/download/v1.10.340/4df037184d634a28b13051a797a25a16_License1.xml to C:\Users\xxx\AppData\Local\Temp\kwazibxi.w1i

Downloading winget... DEBUG: Downloading winget from https://aka.ms/getwinget to C:\Users\sreppien\AppData\Local\Temp\n4nz0a5e.zrk

Installing winget and its dependencies...

###################################################

WARNING! An error occurred during installation!

###################################################

WARNUNG: If messages above don't help and the problem persists, please read the Troubleshooting section of the README: https://github.com/asheroto/winget-install#troubleshooting WARNUNG: Make sure you have the latest version of the script by running this command: winget-install -CheckForUpdate

WARNUNG: Error: Unbekannter Fehler

PS C:\Windows\system32>

The problem seems to be the line: Add-AppxProvisionedPackage -Online -PackagePath $winget_path -DependencyPackagePath $UIXaml_Path, $VCLibs_Path -LicensePath $winget_license_path | Out-Null

StefanReppien avatar Mar 18 '25 14:03 StefanReppien

Image

StefanReppien avatar Mar 18 '25 14:03 StefanReppien

Thanks. So just to confirm, after using winget-install to install winget, winget works, but after updating all, winget will no longer work?

I tested this on a Server 2019 instance, ran winget update -r -h, restarted, and found winget was still working.

Before updating: Image

After updating: Image

winget: Image

I'm happy to get this resolved but will need to replicate the issue to solve it. I know there were some issues with winget-install versions 5.0.5 and 5.0.6. I wonder if this is a separate issue, rather than with Microsoft.DesktopAppInstaller. If I run Get-AppxPackage, I see version 1.25.340.0 installed and winget is working.

Image

This issue appears to be two-fold:

  1. winget not running is likely caused by a path issue, not a dependency problem. Likely caused by version 5.0.6 / 5.0.7 changes.
  2. winget-install should still install even if the Microsoft.DesktopAppInstaller is a lower version, but since we aren't installing MicrosoftDesktopAppInstaller, I'm not sure how to combat this if the Add-AppxProvisionedPackage command is failing.

Any feedback or ideas?

asheroto avatar Mar 24 '25 14:03 asheroto

The Problem starts with Winget-Install 5.0.5 used to install winget on WS2019. AppInstaller 1.24.25200.0 is installed bei winget-install. After winget update -r -h with updates the AppInstaller Version from 1.25.340.0 to 1.25.340.0, winget doesn't work. Power Shell didn't find the winget command anymore.

winget-install -shelfupdate to Version 5.0.6 oder 5.07 can't be installed with winget-install -Force. See Debug Log before.

After Workaround: $FolderPath = "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.25.340.0_x64__8wekyb3d8bbwe" Write-Debug "Setting full control permissions for the Administrators group on $FolderPath."

Define the SID for the Administrators group

$administratorsGroupSid = New-Object System.Security.Principal.SecurityIdentifier("S-1-5-32-544") $administratorsGroup = $administratorsGroupSid.Translate([System.Security.Principal.NTAccount])

Retrieve the current ACL for the folder

$acl = Get-Acl -Path $FolderPath

Define the access rule for full control inheritance

$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule( $administratorsGroup, "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow" )

Apply the access rule to the ACL and set it on the folder

$acl.SetAccessRule($accessRule) Set-Acl -Path $FolderPath -AclObject $acl and

manually change the PATH VAR:

Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\WindowsPowerShell\Scripts;C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.25.340.0_x64__8wekyb3d8bbwe;C:\Users\admin\AppData\Local\Microsoft\WindowsApps

Winget update -r -h will work, but winget-install -UpdateSelf (5.0.7) and winget-Install -Force are broken. See debug Log.

If winget-install -UpdateSelf (5.0.7) and winget-Install -Force before winget update -r -h (with Update Appinstaller), there ist no error. The winget Update off the Appinstaller, didn't break the winget command on WS2019 machines.

So my problem is still, how can I run winget-install UpdateSelf + winget-install -Force on WS2019 machines, which are in a brocken state.

Can you handle Add-AppxProvisionedPackage -Online -PackagePath $winget_path -DependencyPackagePath $UIXaml_Path, $VCLibs_Path -LicensePath $winget_license_path | Out-Null fails with an errorcode and ask, if the script should go on?

StefanReppien avatar Mar 24 '25 14:03 StefanReppien

Power Shell didn't find the winget command anymore.

If it's not finding the command, that is unrelated to Microsoft.DesktopAppInstaller, that's a path/permissions issue. You provided the workaround, can you just run that to fix? That's all the script will be doing anyway...

This section fixes the problem: https://github.com/asheroto/winget-install/blob/7f912f680fc1b6108a625f099417bc7f1e759701/winget-install.ps1#L1214-L1233

Can you handle Add-AppxProvisionedPackage -Online -PackagePath $winget_path -DependencyPackagePath $UIXaml_Path, $VCLibs_Path -LicensePath $winget_license_path | Out-Null fails with an errorcode and ask, if the script should go on?

We have to fix the path permissions after winget is installed. Since it's already installed but the dependencies don't match, I don't know of a straight-forward way I could fix this. It'd be a lot easier just to run the fix on machines in a broken state since that's all the script will be doing anyway, even if we come up with a workaround in the script.

asheroto avatar Mar 24 '25 14:03 asheroto

Closing this issue since the problem appears to be a transitory problem caused by a previous version and a workaround is provided. If you feel this issue should be re-opened please let me know and we can discuss

asheroto avatar Mar 30 '25 14:03 asheroto