33 lines
830 B
PowerShell
33 lines
830 B
PowerShell
|
function Get-EnvironmentName {
|
||
|
<#
|
||
|
|
||
|
.SYNOPSIS
|
||
|
Wrapper for Get-AppSetting for Environment.Name
|
||
|
|
||
|
.PARAMETER ComputerName
|
||
|
[string] The remote computer to connect to. Defaults to localhost.
|
||
|
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
[OutputType([string])]
|
||
|
param (
|
||
|
[Parameter(Mandatory = $false)]
|
||
|
[string]$ComputerName
|
||
|
)
|
||
|
|
||
|
$logLead = (Get-LogLeadName)
|
||
|
|
||
|
if ([string]::IsNullOrWhiteSpace($ComputerName)) {
|
||
|
Write-Warning "$logLead : ComputerName is null or whitespace, assigning 'localhost' to ComputerName"
|
||
|
$ComputerName = 'localhost'
|
||
|
}
|
||
|
|
||
|
$params = @{
|
||
|
Key = "Environment.Name"
|
||
|
ComputerName = $ComputerName
|
||
|
}
|
||
|
|
||
|
$appSetting = Get-AppSetting @params
|
||
|
Write-Verbose "$logLead : ComputerName: [$ComputerName] App Setting value: [$appSetting]"
|
||
|
return $appSetting
|
||
|
}
|