Add dedicated commands for checking software
This commit is contained in:
parent
f518ea07da
commit
a2d0c89424
1 changed files with 31 additions and 0 deletions
|
@ -25,3 +25,34 @@ function Install-SoftwarePackage([Context] $context, [string] $location, [string
|
|||
Remove-Item -Recurse $tempDir;
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks whether the specified package has been installed using Chocolatey.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the package to check.
|
||||
#>
|
||||
function Test-ChocoPackage {
|
||||
[OutputType([bool])]
|
||||
param(
|
||||
[string] $Name
|
||||
);
|
||||
|
||||
-not [string]::IsNullOrEmpty((choco list --limit-output --exact $name));
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks whether a command with the specified name exists.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the command to check.
|
||||
#>
|
||||
function Test-Command {
|
||||
param (
|
||||
[string] $Name
|
||||
)
|
||||
|
||||
[bool] (Get-Command $Name -ErrorAction SilentlyContinue);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue