mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-07-16 00:40:39 +00:00
21 lines
726 B
PowerShell
21 lines
726 B
PowerShell
function Install-WinUtilProgramChoco {
|
|
param (
|
|
[Parameter(Mandatory=$true)]
|
|
[ValidateSet("Install", "Uninstall")]
|
|
[string]$Action,
|
|
|
|
[Parameter(Mandatory=$true)]
|
|
[string[]]$Programs
|
|
)
|
|
|
|
if ($Action -eq 'Install') {
|
|
$arguments = "install $Programs -y"
|
|
} else {
|
|
$arguments = "uninstall $Programs -y"
|
|
}
|
|
|
|
Write-WinUtilLog -Component "Package" -Message "$Action choco package(s): $($Programs -join ', ')"
|
|
$process = Start-Process -FilePath choco -ArgumentList $arguments -NoNewWindow -Wait -PassThru
|
|
Write-WinUtilLog -Component "Package" -Message "$Action choco package(s) completed: $($Programs -join ', ') (exit code: $($process.ExitCode))"
|
|
}
|