diff --git a/scripts/Windows/Scripts/SoftwareManagement.ps1 b/scripts/Windows/Scripts/SoftwareManagement.ps1 index 369a3570..1250fefb 100644 --- a/scripts/Windows/Scripts/SoftwareManagement.ps1 +++ b/scripts/Windows/Scripts/SoftwareManagement.ps1 @@ -42,6 +42,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.