winutil/functions/private/Install-WinUtilProgramWinget.ps1
Chris Titus d0aa396c2a
Test 2024 02 03 (#1583)
* Compile Winutil

* winget fixes and checks

* Compile Winutil

* fix Parsec winget id (#1558)

* Compile Winutil

* fix winget issues

* Compile Winutil

* cleanup winget

* Compile Winutil

* Updated README.md (#1570)

Fixed typos in readme file ("cusom" -> "custom", "twekas" -. "tweaks". Also added full stops.

* Compile Winutil

* Create close-old-issues.yml

* Compile Winutil

* update issues

---------

Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: Saikrishnan K <53394202+K-Saikrishnan@users.noreply.github.com>
Co-authored-by: Harry Perkin <68484588+HarryPerkin@users.noreply.github.com>
2024-02-06 14:02:58 -06:00

45 lines
1.3 KiB
PowerShell

Function Install-WinUtilProgramWinget {
<#
.SYNOPSIS
Manages the provided programs using Winget
.PARAMETER ProgramsToInstall
A list of programs to manage
.PARAMETER manage
The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
.NOTES
The triple quotes are required any time you need a " in a normal script block.
#>
param(
$ProgramsToInstall,
$manage = "Installing"
)
$x = 0
$count = $($ProgramsToInstall -split ",").Count
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
Foreach ($Program in $($ProgramsToInstall -split ",")){
Write-Progress -Activity "$manage Applications" -Status "$manage $Program $($x + 1) of $count" -PercentComplete $($x/$count*100)
if($manage -eq "Installing"){
Start-Process -FilePath winget -ArgumentList "install -e --accept-source-agreements --accept-package-agreements --ignore-security-hash --disable-interactivity --silent $Program" -NoNewWindow -Wait
}
if($manage -eq "Uninstalling"){
Start-Process -FilePath winget -ArgumentList "uninstall -e --purge --force --silent $Program" -NoNewWindow -Wait
}
$X++
}
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
}