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

Run winget upgrade at user logon and prompt user for action to run winget upgrade -all or not

Open thisaoldie opened this issue 3 years ago • 2 comments

  • Run winget upgrade at user logon
  • Display only winget found new packages to upgrade
  • Ask user yes/no to run winget upgrade -all with administration privileges.

thisaoldie avatar Aug 09 '22 00:08 thisaoldie

I’m not sure what the ask is here. Are you adking that this be a feature added to winget? If so, can you provide more clarity around what functionality is missing that you would like to see added?


Running a command at logon isn’t part of winget, it is handled through the Windows Task Scheduler, and you can select a command or program to run at user logon.

To display just the message “Winget found new packages to upgrade” would require checking the length of the output from winget upgrade, or possibly the text. I believe this can be done fairly easily in a batch script

As for the prompt, I could see a request to prompt if a user wishes to upgrade all packages after running winget upgrade but I’m not sure how I would feel about that being the default behavior, especially for scripted / non-interactive scenarios. Again, this seems very easy to do with a custom batch script though.

If my interpretation is accurate, and your post is simply describing something you would like to use winget to do, I think the best recommendation I can give is to create a simple batch script that -

  1. Runs winget upgrade and stores the output to a variable
  2. Checks to see if that variable matches specific text indicating upgrades were found
  3. Use an if statement to determine whether or not user input is required

and then set the batch script to be run on user logon

Trenly avatar Aug 09 '22 12:08 Trenly

Even if this feature is to be implemented, there is https://github.com/Romanitho/Winget-AutoUpdate

russellbanks avatar Aug 16 '22 21:08 russellbanks