An advanced PowerShell script to automate application updates via winget.
Winget-Update is a PowerShell script designed to simplify and automate the process of updating applications via the Windows Package Manager (winget). It offers increased flexibility and advanced features for users and system administrators.
- Automatic application updates via winget
- Multiple update modes (normal, silent, forced, etc.)
- Temporary or permanent application exclusion
- Support for custom parameters for winget
- User-friendly command-line interface
- Windows 10 (version 1809 or later) or Windows 11
- PowerShell 5.1 or later
- Windows Package Manager (winget)
-
Ensure winget is installed on your system.
- To check, open PowerShell and type
winget --version
- If winget is not recognised, install it from the Microsoft Store
- To check, open PowerShell and type
-
Obtain the
winget-update.ps1
script:Option A: Clone the Git repository (recommended)
- Open PowerShell
- Navigate to the folder where you want to clone the repository
- Run the command:
git clone https://github.com/sterbweise/winget-update.git
Option B: Download the script directly
- Visit https://github.com/sterbweise/winget-update
- Click on the
winget-update.ps1
file - Click on the "Raw" button
- Right-click and select "Save as..."
- Choose the save location and click "Save"
-
Add the folder containing the script to your PATH environment variable:
- Open PowerShell as administrator
- Run the following command, replacing
C:\Path\To\The\Folder
with the actual path to the folder containing the script:[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Path\To\The\Folder", "Machine")
- Close and reopen PowerShell for the changes to take effect
-
Create a PowerShell alias for the script:
- Open your PowerShell profile by typing
notepad $PROFILE
in PowerShell - If the file doesn't exist, create it
- Add the following line to the file:
Set-Alias -Name winget-update -Value winget-update.ps1
- Save and close the file
- Reload your PowerShell profile by typing
. $PROFILE
- Open your PowerShell profile by typing
You can now run winget-update
from any location in PowerShell.
Open PowerShell and navigate to the directory containing the script. Run it with the desired parameters: powershell .\winget-update.ps1 [options]
-ExcludeApps
or-e
: Specifies applications to exclude from the current update.-Mode
or-m
: Sets the update mode.-AddPermanentExcludeApps
or-ape
: Adds applications to the permanent exclusion list.-RemovePermanentExcludeApps
or-rpe
: Removes applications from the permanent exclusion list.-CustomParams
or-cp
: Specifies custom parameters to pass directly to winget.-Help
: Displays detailed help for the script.
normal
: Default mode, interactive update.silent
: Silent mode, automatically accepts all agreements.force
: Forced mode, ignores version checks and bypasses some restrictions.verbose
: Provides detailed logging information.no-interaction
: Runs without user interaction, suitable for automated scripts.full-upgrade
: Includes unknown versions and pinned packages in the upgrade.safe-upgrade
: Performs a conservative upgrade, accepting only package agreements.
.\winget-update.ps1
.\winget-update.ps1 -ExcludeApps "App1,App2" -Mode silent
.\winget-update.ps1 -AddPermanentExcludeApps "App3,App4"
.\winget-update.ps1 -Mode force -CustomParams "--no-upgrade"
Contributions are welcome! Feel free to open an issue or submit a pull request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT Licence. See the LICENCE file for details.
Developed with ❤️ by Sterbweise