Winget-cli: UAC prompt when installing application

Created on 21 May 2020  路  10Comments  路  Source: microsoft/winget-cli

It's ugly when you install a package using the command line and after that, a window prompt appears for a mouse click. Instead of this, something like sudo which ask for password before downloading the package will be beautiful and look consistent.

Yeah, you're right we can open the terminal as an administrator but when you working only on CLI it breaks the flow. It doesn't feel nice that you opened another terminal window just for installing a program.

Issue-Feature

Most helpful comment

Could winget elevate itself and then install the packages?

You can run the winget command from an elevated command prompt and won't see any UAC prompts when installing packages.

All 10 comments

In Windows, the closest thing to 'sudo' is Runas: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc771525(v=ws.11)

But the only problem is that the command input is larger compared to just 'sudo winget install package', using runas you would have to do: 'runas /user:\administrator winget install package' (haven't tested that yet)

Could winget elevate itself and then install the packages?

Could winget elevate itself and then install the packages?

You can run the winget command from an elevated command prompt and won't see any UAC prompts when installing packages.

start the command prompt elevated using:

winkey, 'cmd', ctl-shift-enter'

Yeah, you're right we can open the terminal as an administrator but when you working only on CLI it breaks the flow. It doesn't feel nice that you opened another terminal window just for installing a program.

In Windows, the closest thing to 'sudo' is Runas: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc771525(v=ws.11)

But the only problem is that the command input is larger compared to just 'sudo winget install package', using runas you would have to do: 'runas /user:\administrator winget install package' (haven't tested that yet)

This can do the work if implemented with windows 10 and winget. Never thought MSFT already had something similar to sudo.

start the command prompt elevated using:

winkey, 'cmd', ctl-shift-enter'

For some reason I am getting UAC prompts despite doing this. Any ideas?

Edit: Nevermind, fixed it. Some weird issue with SmartScreen.

Opening a separate elevated prompt not only breaks the user workflow, but also introduces other follow-up steps, too. The user potentially needs to refresh the environment in the other terminal instance, or even destroy it and start over, depending on the updates made.

start the command prompt elevated using:

winkey, 'cmd', ctl-shift-enter'

For some reason I am getting UAC prompts despite doing this. Any ideas?

Edit: Nevermind, fixed it. Some weird issue with SmartScreen.

I'm having the same issue, how did you fix it?

start the command prompt elevated using:

winkey, 'cmd', ctl-shift-enter'

For some reason I am getting UAC prompts despite doing this. Any ideas?
Edit: Nevermind, fixed it. Some weird issue with SmartScreen.

I'm having the same issue, how did you fix it?

iirc all I did was change the local group policy via gpedit.msc:
Local Computer Policy -> Computer Configuration -> Administrative Templates -> Windows Components -> Windows Defender SmartScreen -> Explorer -> Configure Windows Defender SmartScreen

Either enable and set to warn, or disable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aetos382 picture aetos382  路  5Comments

auchenberg picture auchenberg  路  3Comments

TomBrien picture TomBrien  路  4Comments

ermshiperete picture ermshiperete  路  3Comments

Callidior picture Callidior  路  5Comments