2023-03-07 12:28:00 -08:00
|
|
|
function Test-WinUtilPackageManager {
|
|
|
|
|
<#
|
2023-10-19 17:12:55 -05:00
|
|
|
|
|
|
|
|
.SYNOPSIS
|
|
|
|
|
Checks if Winget and/or Choco are installed
|
|
|
|
|
|
|
|
|
|
.PARAMETER winget
|
|
|
|
|
Check if Winget is installed
|
|
|
|
|
|
|
|
|
|
.PARAMETER choco
|
|
|
|
|
Check if Chocolatey is installed
|
|
|
|
|
|
2023-03-07 12:28:00 -08:00
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
Param(
|
|
|
|
|
[System.Management.Automation.SwitchParameter]$winget,
|
|
|
|
|
[System.Management.Automation.SwitchParameter]$choco
|
|
|
|
|
)
|
|
|
|
|
|
2024-02-06 14:02:58 -06:00
|
|
|
if ($winget) {
|
2026-01-06 00:16:19 +02:00
|
|
|
if (Get-Command winget -ErrorAction SilentlyContinue) {
|
2024-03-30 11:46:29 -05:00
|
|
|
Write-Host "===========================================" -ForegroundColor Green
|
2024-04-20 16:38:43 -05:00
|
|
|
Write-Host "--- Winget is installed ---" -ForegroundColor Green
|
2024-03-30 11:46:29 -05:00
|
|
|
Write-Host "===========================================" -ForegroundColor Green
|
2026-01-06 00:16:19 +02:00
|
|
|
$status = "installed"
|
2024-06-29 01:15:39 +03:00
|
|
|
} else {
|
2024-03-30 11:46:29 -05:00
|
|
|
Write-Host "===========================================" -ForegroundColor Red
|
2024-04-20 16:38:43 -05:00
|
|
|
Write-Host "--- Winget is not installed ---" -ForegroundColor Red
|
2024-03-30 11:46:29 -05:00
|
|
|
Write-Host "===========================================" -ForegroundColor Red
|
|
|
|
|
$status = "not-installed"
|
2023-03-07 12:28:00 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-21 16:23:24 -07:00
|
|
|
if ($choco) {
|
2026-01-06 00:16:19 +02:00
|
|
|
if (Get-Command choco -ErrorAction SilentlyContinue) {
|
2024-03-30 11:46:29 -05:00
|
|
|
Write-Host "===========================================" -ForegroundColor Green
|
2024-04-20 16:38:43 -05:00
|
|
|
Write-Host "--- Chocolatey is installed ---" -ForegroundColor Green
|
2024-03-30 11:46:29 -05:00
|
|
|
Write-Host "===========================================" -ForegroundColor Green
|
|
|
|
|
$status = "installed"
|
|
|
|
|
} else {
|
|
|
|
|
Write-Host "===========================================" -ForegroundColor Red
|
2024-04-20 16:38:43 -05:00
|
|
|
Write-Host "--- Chocolatey is not installed ---" -ForegroundColor Red
|
2024-03-30 11:46:29 -05:00
|
|
|
Write-Host "===========================================" -ForegroundColor Red
|
|
|
|
|
$status = "not-installed"
|
2023-03-07 12:28:00 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-30 11:46:29 -05:00
|
|
|
return $status
|
2024-03-21 16:23:24 -07:00
|
|
|
}
|