diff --git a/scripts/Windows/Scripts/SoftwareManagement.ps1 b/scripts/Windows/Scripts/SoftwareManagement.ps1 index 95a44a2f..c1047a10 100644 --- a/scripts/Windows/Scripts/SoftwareManagement.ps1 +++ b/scripts/Windows/Scripts/SoftwareManagement.ps1 @@ -43,6 +43,22 @@ function Test-ChocoPackage { -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 Checks whether a command with the specified name exists.