Winget basics

1 minute read

Winget Basics: Updating and Automating Basic Winget Tasks

Winget (Windows Package Manager) is a command-line tool that allows you to install, update, and manage applications on Windows easily. It has been around for a few years now, but many IT admins do not know it exists or how it can be intergrated into day to day admin tasks for FREE.

This guide covers the basics of using Winget to update applications and automate routine tasks.

Installing Winget

Most modern Windows 10 and 11 versions come with Winget preinstalled. To check if Winget is available, run the following command in PowerShell or Command Prompt:

winget --version

If it’s not installed, download it from the Microsoft Store or install it via PowerShell.

For a list of applications that can be installed/updated by Winget check the Winget pkgs Github


Updating Installed Applications

For a list of upgradable apps:

winget upgrade

To update a single application, use:

winget upgrade "App ID"

To update all applications at once:

winget upgrade --all

To force update all apps without prompts:

winget upgrade --all --silent --accept-package-agreements --accept-source-agreements

Installing Applications

To install a new application:

winget install "App Name"

For a silent installation without prompts:

winget install "App Name" --silent --accept-package-agreements

Automating Winget Tasks with Scripts

You can automate Winget tasks using PowerShell scripts. For example, to update all applications daily:

  1. Open Notepad and enter the following script:
winget upgrade --all --silent --accept-package-agreements --accept-source-agreements
  1. Save it as update-winget.ps1.
  2. Open Task Scheduler and create a new task:
    • Set it to run daily.
    • Choose Start a Program and select powershell.exe as the program.
    • Add -ExecutionPolicy Bypass -File "C:\path\to\update-winget.ps1" as arguments.

This ensures applications stay up to date automatically. That script could also be deployed via inTune


Exporting and Importing Installed Apps

To export a list of installed applications (could be used to baseline a build to make rolling out apps easy):

winget export -o apps.json

To reinstall apps from the list:

winget import -i apps.json

Conclusion

Winget simplifies software management on Windows, allowing you to update, install, and automate tasks with ease. By integrating it with scripts and Task Scheduler, you can maintain your applications effortlessly and help achieve Cyber Essentails.

Updated: