winutil
winutil copied to clipboard
Error when installing Spotify
Describe the bug Spotify does not install when installer is ran in administrator mode.
To Reproduce Steps to reproduce the behavior:
- Run the script
- Check Spotify under Multimedia Tools
- Click on Start Install
- Wait for error message to popup
Expected behavior The Spotify installer runs and successfully installs.
Screenshots
Additional context A possible fix.
When installing all checked programs, check if Spotify is installed, if Spotify is checked then run Spotify installer in non-administrator Powershell, after Spotify is done installing, install other checked programs.
EDIT: Tried the fix above. First the installer started in non-administrator Powershell, but then I was prompted to open in administrator Powershell which then continued the install and resulted in the same error. I may have implemented this fix wrong, feel free to try your own way.
@DeveloperDurp This looks right down your alley
I am thinking of ways to handle it. By default the script will create an elevated shell for winget and install everything. The most simple way to handle this might be a way of tagging if an application requires admin or not and go from there. However the problem will then become if it's already in an elevated shell and at this moment I don't know of a method to return to a normal shell.
This will also happen in the test.ps1 as well since I force admin for now until I can figure out this privileges trap.
Could do a catch and force it into usermode with runas
Example:
runas /user:$env:UserName "winget install -e Spotify.Spotify --force"
Downside is it would require the user to enter their password.
You can run as normal user without entering a password by running through explorer.exe
or by making a task in task scheduler.
Though running through explorer.exe
has some problems as I haven't been able to run programs with arguments that way. I've gotten around this by running .bat
files.
I just don't know if either of these ways can run as blocking, if that is wanted.
Removed from winutil.