Add a function for checking winget packages

This commit is contained in:
Manuel Thalmann 2024-08-07 13:18:29 +02:00
parent 7177fa97ca
commit d64feb232a

View file

@ -42,6 +42,22 @@ function Test-ChocoPackage {
-not [string]::IsNullOrEmpty((choco list --limit-output --exact $name)); -not [string]::IsNullOrEmpty((choco list --limit-output --exact $name));
} }
<#
.SYNOPSIS
Checks whether a `winget` package with the specified id is installed.
.PARAMETER ID
The id of the package to check.
#>
function Test-WingetPackage {
[OutputType([bool])]
param(
[string] $ID
)
-not (& { $null = winget list --accept-source-agreements -e --id $ID; $?; });
}
<# <#
.SYNOPSIS .SYNOPSIS
Checks whether a command with the specified name exists. Checks whether a command with the specified name exists.