mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 22:55:52 -06:00
27 lines
674 B
PowerShell
27 lines
674 B
PowerShell
|
function Test-WinUtilPackageManager {
|
||
|
<#
|
||
|
|
||
|
.DESCRIPTION
|
||
|
Checks for Winget or Choco depending on the paramater
|
||
|
|
||
|
#>
|
||
|
|
||
|
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
|
||
|
}
|