45 lines
836 B
PowerShell
45 lines
836 B
PowerShell
<#
|
|
.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);
|
|
}
|
|
|
|
<#
|
|
.SYNOPSIS
|
|
Checks whether a package with the specified name is installed.
|
|
|
|
.PARAMETER Name
|
|
The name of the package to check.
|
|
#>
|
|
function Test-PSPackage {
|
|
param(
|
|
[string] $Name
|
|
)
|
|
|
|
[bool] (Get-Package $Name -ErrorAction SilentlyContinue);
|
|
}
|
|
|
|
<#
|
|
.SYNOPSIS
|
|
Checks whether a module with the specified name is installed.
|
|
|
|
.PARAMETER Name
|
|
The name of the module to check.
|
|
#>
|
|
function Test-PSModule {
|
|
param(
|
|
[string] $Name
|
|
)
|
|
|
|
[bool](Get-Module -ListAvailable $Name -ErrorAction SilentlyContinue);
|
|
}
|