From 3a8118e0f7a620d4ab267cac1a0ab4062222d3c8 Mon Sep 17 00:00:00 2001 From: Brian Lalonde Date: Tue, 9 Dec 2025 21:37:18 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20`Update-Everything.ps1`:=20Prefe?= =?UTF-8?q?r=20winget=20to=20choco=20for=20essentiel=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - resolves #102 --- Update-Everything.cmd | 2 ++ Update-Everything.ps1 | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Update-Everything.cmd b/Update-Everything.cmd index 47d85ed5..a78a7769 100644 --- a/Update-Everything.cmd +++ b/Update-Everything.cmd @@ -1,5 +1,7 @@ taskkill /im powershell.exe /f taskkill /im pwsh.exe /f taskkill /im WindowsTerminal.exe /f +( winget upgrade -e --id Microsoft.WindowsTerminal && +winget upgrade -e --id Microsoft.PowerShell ) || choco upgrade powershell powershell-core microsoft-windows-terminal -y pwsh -nol -nop -noni -file %~dpn0.ps1 diff --git a/Update-Everything.ps1 b/Update-Everything.ps1 index f22dc73c..d70e3d9d 100644 --- a/Update-Everything.ps1 +++ b/Update-Everything.ps1 @@ -154,23 +154,23 @@ Begin [CmdletBinding()] Param() if($Script:IsNotAdministrator) {Write-Warning "Not running as admin; skipping Essential."; return} Write-Step "$([char]0xD83D)$([char]0xDD1C) Checking for essential updates" - if(Get-Command choco -ErrorAction Ignore) + if(Get-Command winget -ErrorAction Ignore) { - if(choco outdated -r | - ConvertFrom-Csv -Delimiter '|' -Header PackageName,LocalVersion,AvailableVersion | - Where-Object PackageName -in powershell,powershell-core,microsoft-windows-terminal) - {Invoke-EssentialUpdate} - } - elseif(Get-Command winget -ErrorAction Ignore) - { - if(@(winget list Microsoft.WindowsTerminal | + if(@(winget list -e --id Microsoft.WindowsTerminal -s winget --upgrade-available --disable-interactivity --nowarn | Select-Object -Skip 2 -First 1 | Select-String Available && - winget list Microsoft.PowerShell | + winget list -e --id Microsoft.PowerShell -s winget --upgrade-available --disable-interactivity --nowarn | Select-Object -Skip 2 -First 1 | Select-String Available).Count -gt 0) {Invoke-EssentialUpdate} } + elseif(Get-Command choco -ErrorAction Ignore) + { + if(choco outdated -r | + ConvertFrom-Csv -Delimiter '|' -Header PackageName,LocalVersion,AvailableVersion | + Where-Object PackageName -in powershell,powershell-core,microsoft-windows-terminal) + {Invoke-EssentialUpdate} + } else { Write-Verbose 'Neither Chocolatey nor WinGet found, skipping essential updates'