Added a menu option for running winget upgrade from the menu

This commit is contained in:
shaun.greatbatch
2025-09-18 12:12:57 +01:00
parent a9da038121
commit b3524a8831

View File

@ -271,6 +271,12 @@ function Do-RestartServiceMenu {
} while ($true) } while ($true)
} }
function do-wingetupgrades {
winget upgrade --all --silent --accept-source-agreements --accept-package-agreements
}
# ------- Main Menu ------- # ------- Main Menu -------
do { do {
Clear-Host Clear-Host
@ -280,6 +286,7 @@ do {
Write-Host " 3) Show IP addresses" Write-Host " 3) Show IP addresses"
Write-Host " 4) Ping a host" Write-Host " 4) Ping a host"
Write-Host " 5) Restart a service (submenu)" Write-Host " 5) Restart a service (submenu)"
write-Host " 6) Run Winget Upgrades"
Write-Host " 0) Quit`n" Write-Host " 0) Quit`n"
$choice = Read-Host "Choose an option" $choice = Read-Host "Choose an option"
@ -289,6 +296,7 @@ do {
'3' { Do-ShowIP; Read-Host "`nPress Enter to return to menu" | Out-Null } '3' { Do-ShowIP; Read-Host "`nPress Enter to return to menu" | Out-Null }
'4' { Do-PingHost; Read-Host "`nPress Enter to return to menu" | Out-Null } '4' { Do-PingHost; Read-Host "`nPress Enter to return to menu" | Out-Null }
'5' { Do-RestartServiceMenu } '5' { Do-RestartServiceMenu }
'6' { do-wingetupgrades }
'0' { exit } '0' { exit }
default { default {
Write-Host "Invalid choice." -ForegroundColor Yellow Write-Host "Invalid choice." -ForegroundColor Yellow