mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-02-04 15:00:09 +00:00
* Update Install-WinUtilWinget.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilWinget.ps1 * Update Test-WinUtilPackageManager.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilWinget.ps1 * Change error action to SilentlyContinue for commands * Fix indentation in Test-WinUtilPackageManager.ps1 --------- Co-authored-by: Gabi <218829269+Gabynun@users.noreply.github.com> Co-authored-by: Chris Titus <contact@christitus.com>
50 lines
1.8 KiB
PowerShell
50 lines
1.8 KiB
PowerShell
function Test-WinUtilPackageManager {
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Checks if Winget and/or Choco are installed
|
|
|
|
.PARAMETER winget
|
|
Check if Winget is installed
|
|
|
|
.PARAMETER choco
|
|
Check if Chocolatey is installed
|
|
|
|
#>
|
|
|
|
Param(
|
|
[System.Management.Automation.SwitchParameter]$winget,
|
|
[System.Management.Automation.SwitchParameter]$choco
|
|
)
|
|
|
|
if ($winget) {
|
|
if (Get-Command winget -ErrorAction SilentlyContinue) {
|
|
Write-Host "===========================================" -ForegroundColor Green
|
|
Write-Host "--- Winget is installed ---" -ForegroundColor Green
|
|
Write-Host "===========================================" -ForegroundColor Green
|
|
$status = "installed"
|
|
} else {
|
|
Write-Host "===========================================" -ForegroundColor Red
|
|
Write-Host "--- Winget is not installed ---" -ForegroundColor Red
|
|
Write-Host "===========================================" -ForegroundColor Red
|
|
$status = "not-installed"
|
|
}
|
|
}
|
|
|
|
if ($choco) {
|
|
if (Get-Command choco -ErrorAction SilentlyContinue) {
|
|
Write-Host "===========================================" -ForegroundColor Green
|
|
Write-Host "--- Chocolatey is installed ---" -ForegroundColor Green
|
|
Write-Host "===========================================" -ForegroundColor Green
|
|
$status = "installed"
|
|
} else {
|
|
Write-Host "===========================================" -ForegroundColor Red
|
|
Write-Host "--- Chocolatey is not installed ---" -ForegroundColor Red
|
|
Write-Host "===========================================" -ForegroundColor Red
|
|
$status = "not-installed"
|
|
}
|
|
}
|
|
|
|
return $status
|
|
}
|