DEV Community

Cover image for Installing software with winget & automating installation with PowerShell
Doug Waldron
Doug Waldron

Posted on

Installing software with winget & automating installation with PowerShell

Windows released a new command line tool in 2021 for installing software called winget. I recently got a new computer at work, so it was a good opportunity to try it out, and my verdict is: wow, it's really good!

Using this PowerShell script, within about 10 minutes I had installed over 30 applications with no interaction needed from me. (I based my script on one originally created by Chris Ayers)

Here's a quick tutorial on using winget:

  • Winget comes pre-installed on new computers, but if you don't have it, just install the App Installer from the Microsoft Store.

  • winget list shows all applications you currently have installed and labels which ones are available through winget. This is a good way to prepare your own setup script, especially if you're planning to get a new computer.

    Screenshot of  raw `winget list` endraw  results

  • winget search <name of app> to find out if an app you want can be installed through winget.

    Screenshot of  raw `winget search "google chrome"` endraw  results

  • winget install and winget uninstall do exactly what you think.

You can install each app separately using those commands. Or if you want to use the script to automate it, here's how to do that:

  1. Edit the InstallSoftware.ps1 file to include the apps you want.
  2. Start PowerShell as administrator.
  3. If running scripts is blocked (it should be), you can temporarily unblock them by running Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
  4. Run the script and enjoy!

Screenshot of PowerShell script installing software

Top comments (0)