Skip to content

Instantly share code, notes, and snippets.

@arpan3t
arpan3t / Switch-PsUpdater.ps1
Created September 10, 2024 16:55
PowerShell update checker that checks WinGet manifest before showing notification
# Current pwsh update notification code triggers notification on new release published to PowerShell repo.
# WinGet manifest is being updated manually (up to 3 days) after new releases, resulting in premature update notifications.
# This is a temporary solution until PowerShell adds WinGet manifest update to it's CI/CD pipeline.
# Add snippet to profile. To revert back - change psupdate check env variable to Default and remove snippet from profile.
# More info can be found at the following links:
# about_Update_Notifications - https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_update_notifications?view=powershell-7.4
# Update notification code - https://github.com/PowerShell/PowerShell/blob/master/src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs
# CI/CD pipeline issue - https://github.com/PowerShell/PowerShell/issues/19927#issuecomment-2278451507
# Banner replacement issue - https://github.com/PowerShell/PowerShell/issues/20474#issuecommen