After using chocolatey for the organization of software under windows, it quickly became apparent that no notification was provided to warn of outdated packages.
It is by starting from this principle and by failing with the other proposed methods, that I decided to build a powershell script in order to:
- obtain a notification when have outdated packages
- Ability to view outdated packages with the notification
- Ability to upgrade outdated packages with the notification
- all without any action!
In the end, you get a notification warning you of outdated packages and you can click to view all packages as well as click to upgrade them immediately.
- Install BurntToast (Powershell module):
Install-Module BurntToast
This may require the installation of NuGet and a Powershell version ≥ 7.0
- WINDOWS : see all the details delow
- Position the 3 files at the root of your computer (e.g. at the root of C:) :
- C:\notification_choco.ps1
- C:\check_choco.ps1
- C:\upgrade_choco.ps1
- Creation of the scheduled task: tutorial
- Check "Run with highest privileges"
- Add triggers: e.g. every day at 12:00 p.m. and at each session opening
- Add an action:
- Start a program : powershell or the full address of the program (C: / ... powershell.exe)
- Add arguments :
-WindowStyle Hidden -NonInteractive -ExecutionPolicy Bypass -File "C:\notification_choco.ps1"
- Install PowerShell 7.x:
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
- Add PowerShell 7.x in path: Advanced system settings > Environnement Variables > System variables > "Path" (Edit) > New > "C:\Program Files\PowerShell\7"
- IMPORTANT! During the first execution windows will ask if we really want to open this file (unknown editor etc ...). You must uncheck "always ask before opening this file" and click on "open". This for all scripts.
You can also import the "Notification_choco.xml" file directly into the task scheduler (only if the 3 files are in the root of C: and powershell are in the path of the system).
And There you go !