microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.22k stars 1.45k forks source link

Cannot install a windows store app for all users : The current system configuration does not support the installation of this package #3923

Open sebma opened 11 months ago

sebma commented 11 months ago

Brief description of your issue

I cannot install a windows store app for all users : The current system configuration does not support the installation of this package with winget.

Steps to reproduce

I type this command :

PS C:\Windows\System32> winget install --accept-package-agreements --id 9NF8H0H7WMLT --scope machine
Found NVIDIA Control Panel [9NF8H0H7WMLT] Version Unknown
This package is provided through Microsoft Store. winget may need to acquire the package from Microsoft Store on behalf of the current user.
Agreements for NVIDIA Control Panel [9NF8H0H7WMLT] Version Unknown
Version: Unknown
Publisher: NVIDIA Corp.
Description: Featuring display management, application, and gaming-specific features, the NVIDIA Control Panel ensures the best overall experience using NVIDIA graphics
License: ms-windows-store://pdp/?ProductId=9NF8H0H7WMLT
Privacy Url: https://www.nvidia.com/en-in/privacy-center/
Agreements:
Category: Utilities & tools
Pricing: Free
Free Trial: No
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
Seizure Warning: https://aka.ms/microsoft-store-seizure-warning
Store License Terms: https://aka.ms/microsoft-store-license

Starting package install...
The current system configuration does not support the installation of this package.
PS C:\Windows\System32>

Expected behavior

It installs the package for all users.

Actual behavior

It fails with this error : The current system configuration does not support the installation of this package.

Environment

Windows Package Manager v1.6.2771
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19045.3693
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.2771.0
Trenly commented 11 months ago

Can you provide the log files from winget install --accept-package-agreements --id 9NF8H0H7WMLT --scope machine --verbose-logs

It's also possible that this is because you are attempting to install machine-wide from the MSStore. There is a snippet of code (below) which seems to be requiring system permissions for this due to an OS bug https://github.com/microsoft/winget-cli/blob/113debcc0f3fe968c58b60162f6b957b832c7498/src/AppInstallerCommonCore/MSStore.cpp#L125-L134

sebma commented 11 months ago

@Trenly Hi, this command does not seem to be more verbose on my system :

PS C:\Windows\system32> winget install --accept-package-agreements --id 9NF8H0H7WMLT --scope machine --verbose-logs
Found NVIDIA Control Panel [9NF8H0H7WMLT] Version Unknown
This package is provided through Microsoft Store. winget may need to acquire the package from Microsoft Store on behalf of the current user.
Agreements for NVIDIA Control Panel [9NF8H0H7WMLT] Version Unknown
Version: Unknown
Publisher: NVIDIA Corp.
Description: Featuring display management, application, and gaming-specific features, the NVIDIA Control Panel ensures the best overall experience using NVIDIA graphics
License: ms-windows-store://pdp/?ProductId=9NF8H0H7WMLT
Privacy Url: https://www.nvidia.com/en-in/privacy-center/
Agreements:
Category: Utilities & tools
Pricing: Free
Free Trial: No
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
Seizure Warning: https://aka.ms/microsoft-store-seizure-warning
Store License Terms: https://aka.ms/microsoft-store-license

Starting package install...
The current system configuration does not support the installation of this package.
PS C:\Windows\system32>

Where is the install log stored ?

Trenly commented 11 months ago

@Trenly Hi, this command does not seem to be more verbose on my system :

PS C:\Windows\system32> winget install --accept-package-agreements --id 9NF8H0H7WMLT --scope machine --verbose-logs
Found NVIDIA Control Panel [9NF8H0H7WMLT] Version Unknown
This package is provided through Microsoft Store. winget may need to acquire the package from Microsoft Store on behalf of the current user.
Agreements for NVIDIA Control Panel [9NF8H0H7WMLT] Version Unknown
Version: Unknown
Publisher: NVIDIA Corp.
Description: Featuring display management, application, and gaming-specific features, the NVIDIA Control Panel ensures the best overall experience using NVIDIA graphics
License: ms-windows-store://pdp/?ProductId=9NF8H0H7WMLT
Privacy Url: https://www.nvidia.com/en-in/privacy-center/
Agreements:
Category: Utilities & tools
Pricing: Free
Free Trial: No
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
Seizure Warning: https://aka.ms/microsoft-store-seizure-warning
Store License Terms: https://aka.ms/microsoft-store-license

Starting package install...
The current system configuration does not support the installation of this package.
PS C:\Windows\system32>

Where is the install log stored ?

The log directory can be found using winget --info or winget --logs

sebma commented 11 months ago

@Trenly Thanks, there is the log file : WinGet-2023-11-23-16-12-57.847.log

Trenly commented 11 months ago

There it is! Right at the bottom of the log file -

2023-11-23 16:13:00.008 [CORE] Device wide install for msstore type is not supported under admin context.

sebma commented 11 months ago

@Trenly Is there a workaround ?

Trenly commented 11 months ago

According to the code, the only workaround for the OS bug is to run winget as SYSTEM. The other option would be to install just for the current user, or to not use winget for this specific install

sebma commented 11 months ago

@Trenly How do I open a powershell Window as SYSTEM ?

bandizsolt commented 11 months ago

@sebma, you can use this tool to open PowerShell as the system: https://learn.microsoft.com/en-us/sysinternals/downloads/psexec

For example:

Psexec.exe -i -s C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe

Alternatively, you can create a task in Task Scheduler to run a script as the system, or you can use this tool as well: https://www.nirsoft.net/utils/advanced_run.html

sebma commented 11 months ago

@bandizsolt Or a cmd.exe with :

psexec -i -s cmd.exe

Thank you 👍