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

Unable to install programs which require Admin

Open filiphorvat opened this issue 2 years ago • 7 comments

Brief description of your issue

Winget is unable to install programs which require Admin. Winget disables inheritance on the C:\Users\username\AppData\Local\Temp\WinGet folder so the administrator accounts can't access it. Even after manually enabling inheritance, the next winget install disables it again and fails.

Steps to reproduce

winget install any program that requires an Admin password

Expected behavior

The program installs.

Actual behavior

The program fails installing with the error The network name cannot be found, or similar.

Environment

Windows Package Manager (Preview) v1.4.3132-preview
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19045.2311
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.19.3132.0

filiphorvat avatar Dec 04 '22 00:12 filiphorvat

@filiphorvat Can you run an instance of this with winget install <package> --verbose-logs and share the log file? The location is displayed via winget --info.

denelon avatar Dec 05 '22 17:12 denelon

Here it is for winget install wiztree --verbose-logs: WinGet-2022-12-05-18-22-32.594.log Looks like this after typing in the admin password: image

Or like this when installing Steam: image Here's the log for Steam: WinGet-2022-12-05-18-34-06.014.log Even manually running the installer from the temp directory doesn't work if I don't re-enable inheritance.

filiphorvat avatar Dec 05 '22 17:12 filiphorvat

same as me, my settings via winget settings

winver: Windows Server 2022 Standard 21H2 20348.1311

{
    "$schema": "https://aka.ms/winget-settings.schema.json",

    // For documentation on these settings, see: https://aka.ms/winget-settings
    // "source": {
    //    "autoUpdateIntervalInMinutes": 5
    // },
    "telemetry": {
        "disable": true
    },
    "network": {
        "downloader": "wininet"
    },
    "source": {
        "autoUpdateIntervalInMinutes": 360
    },
    //"logging": {
    //    "level": "verbose"
    //},
    "installBehavior": {
        "preferences": {
            "scope": "machine"
        }
    }
}

jueti avatar Dec 20 '22 03:12 jueti

same as here https://github.com/microsoft/winget-cli/issues/2665

MS ignores it.

To install any programs with EXE Installers I do:

  1. Try first time winget update --id....
  2. Go into %TEMP%\Winget\
  3. Give to Administrator the permissions to access the applications's folder in %TEMP%\Winget
  4. Try second time winget upgrade --id...

Really good user experience....

AlexDe74 avatar Jan 10 '23 06:01 AlexDe74

The same behavior for me on Windows 11. Normal user without administrator rights tries to install a program with winget. Winget loads the installation files to C:\Users\USERNAME\AppData\Local\Temp\WinGet, sets own permissions. Full access for the current account and system and removes inheritance. The local administrator has no rights to the directory. Then WinGet requests the administrator rights. After that winget aborts with an error that it cannot access the installation files. Which was predictable if the local administrator lacks the rights. Apparently the Winget developers always work with administrator rights, otherwise they would have noticed the error immediately.

ghborger avatar Feb 01 '23 09:02 ghborger

Can confirm we are able to replicate it on our tenant with onenote as it uses an exe As a workaround we are downloading it from the ms website It happens both on the store or through winget

rand0muser123 avatar Feb 02 '23 03:02 rand0muser123

Hi,

How about the feature where you can set the download directory for winget packages in settings file? Some directory where all the users has rw-rights.

boozeman avatar Feb 02 '23 18:02 boozeman

I can confirm that this is fixed in 1.5 preview of winget. I really wonder why this bug even made it to a release. Does nobody really work without admin rights?

nk111 avatar Apr 18 '23 18:04 nk111

I can confirm that this is fixed in 1.5 preview of winget. I really wonder why this bug even made it to a release. Does nobody really work without admin rights?

Principle of least privilege says you shouldn't

Masamune3210 avatar Apr 18 '23 18:04 Masamune3210

same error Windows 11 22H2

the administrator account is being removed from the winget folder found in the temp folder every time the store reloads, why is this happening, Microsoft should be keeping the administrator privileges on this folder?

error

UnidentifiedTag avatar Jun 28 '23 17:06 UnidentifiedTag