23 lines
635 B
PowerShell
23 lines
635 B
PowerShell
|
function Get-ConfigSetting {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
This function will get the config setting on the machine starting with the machine.config, and progressing to the environment variables
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
param (
|
||
|
[Parameter(Mandatory = $true, Position = 0)]
|
||
|
[Alias("Name")]
|
||
|
[string]$Key
|
||
|
)
|
||
|
|
||
|
$logLead = (Get-LogLeadName)
|
||
|
|
||
|
$settingValue = (Get-AppSetting -Key $Key)
|
||
|
|
||
|
if ($null -eq $settingValue) {
|
||
|
Write-Verbose "$logLead : Setting not found in machine config, trying environment variables"
|
||
|
$settingValue = (Get-EnvironmentVariable -Key $Key)
|
||
|
}
|
||
|
|
||
|
return $settingValue
|
||
|
}
|