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

33 lines
772 B
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
)
if($winget){
if (Test-Path ~\AppData\Local\Microsoft\WindowsApps\winget.exe) {
return $true
}
}
if($choco){
if ((Get-Command -Name choco -ErrorAction Ignore) -and ($chocoVersion = (Get-Item "$env:ChocolateyInstall\choco.exe" -ErrorAction Ignore).VersionInfo.ProductVersion)){
return $true
}
}
return $false
}