Files
winutil/functions/private/Test-WinUtilPackageManager.ps1
T

50 lines
1.8 KiB
PowerShell
Raw Normal View History

+3
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
+3
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) {
if (Get-Command winget -ErrorAction SilentlyContinue) {
Write-Host "===========================================" -ForegroundColor Green
+1
2024-04-20 16:38:43 -05:00
Write-Host "--- Winget is installed ---" -ForegroundColor Green
Write-Host "===========================================" -ForegroundColor Green
$status = "installed"
} else {
Write-Host "===========================================" -ForegroundColor Red
+1
2024-04-20 16:38:43 -05:00
Write-Host "--- Winget is not installed ---" -ForegroundColor Red
Write-Host "===========================================" -ForegroundColor Red
$status = "not-installed"
+3
2023-03-07 12:28:00 -08:00
}
}
+8
2024-03-21 16:23:24 -07:00
if ($choco) {
if (Get-Command choco -ErrorAction SilentlyContinue) {
Write-Host "===========================================" -ForegroundColor Green
+1
2024-04-20 16:38:43 -05:00
Write-Host "--- Chocolatey is installed ---" -ForegroundColor Green
Write-Host "===========================================" -ForegroundColor Green
$status = "installed"
} else {
Write-Host "===========================================" -ForegroundColor Red
+1
2024-04-20 16:38:43 -05:00
Write-Host "--- Chocolatey is not installed ---" -ForegroundColor Red
Write-Host "===========================================" -ForegroundColor Red
$status = "not-installed"
+3
2023-03-07 12:28:00 -08:00
}
}
return $status
+8
2024-03-21 16:23:24 -07:00
}