winutil/functions/private/Update-WinUtilProgramWinget.ps1
2023-10-04 10:08:10 -05:00

22 lines
598 B
PowerShell

Function Update-WinUtilProgramWinget {
<#
.DESCRIPTION
This will update programs via Winget using a new powershell.exe instance to prevent the GUI from locking up.
#>
[ScriptBlock]$wingetinstall = {
$host.ui.RawUI.WindowTitle = """Winget Install"""
Start-Transcript $ENV:TEMP\winget-update.log -Append
winget upgrade --all
Pause
}
$global:WinGetInstall = Start-Process -Verb runas powershell -ArgumentList "-command invoke-command -scriptblock {$wingetinstall} -argumentlist '$($ProgramsToInstall -join ",")'" -PassThru
}