Skip to content

Instantly share code, notes, and snippets.

@ronilaukkarinen
Created April 27, 2025 17:41
Show Gist options
  • Save ronilaukkarinen/fb80026c0ff0efc599cdd353dbe44477 to your computer and use it in GitHub Desktop.
Save ronilaukkarinen/fb80026c0ff0efc599cdd353dbe44477 to your computer and use it in GitHub Desktop.
Winget Update Check
# Save this file to:
# C:\Scripts\winget-update-check.ps1
Write-Host "Checking for package updates..." -ForegroundColor Cyan
winget upgrade
$answer = Read-Host "`nDo you want to update all packages now? (Y/N)"
if ($answer -match "^[Yy]$") {
winget upgrade --all
} else {
Write-Host "Skipping updates." -ForegroundColor Yellow
}
# Open Task Scheduler → Create Task:
# General-tab:
# Name: Winget Update Check
# Location: \
# Author: Leave intact
# Description: Can be empty
# [x] Run only when user is logged on
#
# Triggers-tab:
# New → At logon (each boot when you log in)
# [x] Enabled
#
# Actions-tab:
# New → Start a program
# Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\ and there select powershell.exe
# Add arguments: -NoExit -ExecutionPolicy Bypass -File "C:\Scripts\winget-update-check.ps1"
# -NoExit keeps the window open after it finishes, so you see the output!
# Save and you're done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment