33 lines
772 B
PowerShell
33 lines
772 B
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 (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
|
|
} |