ps/Modules/Alkami.PowerShell.Configuration/Public/Test-IsEnvironment.ps1
2023-05-30 22:51:22 -07:00

29 lines
1.1 KiB
PowerShell

function Test-IsEnvironment {
<#
.SYNOPSIS
Check if a computer is a certain environment type
.PARAMETER ComputerName
What computer do we check, defaults to localhost
#>
[CmdletBinding()]
[OutputType([System.Boolean])]
param (
[Parameter(Mandatory=$true)]
[ValidateSet('Production', 'QA', 'Development', 'LoadTest', 'Build', 'Unconfigured')]
[string]$EnvironmentType,
[string]$ComputerName = 'localhost'
)
$typeMatches = switch ($EnvironmentType) {
'Production' { return Test-IsProductionEnvironment -ComputerName $ComputerName}
'QA' { return Test-IsQAEnvironment -ComputerName $ComputerName}
'Development' { return Test-IsDeveloperMachine -ComputerName $ComputerName}
'LoadTest' { return Test-IsLoadTestEnvironment -ComputerName $ComputerName}
'Build' { return Test-IsBuildEnvironment -ComputerName $ComputerName}
'Unconfigured' { return Test-IsUnconfiguredEnvironment -ComputerName $ComputerName}
default { throw "what is $EnvironmentType" }
}
return $typeMatches
}