38 lines
985 B
PowerShell
38 lines
985 B
PowerShell
|
function Set-EnvironmentDesignation {
|
||
|
<#
|
||
|
|
||
|
.SYNOPSIS
|
||
|
Get the App Setting of Environment.Designation
|
||
|
|
||
|
.PARAMETER Value
|
||
|
[string] The appSetting value to set, if it's different than the existing file
|
||
|
|
||
|
.PARAMETER ComputerName
|
||
|
[string] The computer to connect to Defaults to localhost
|
||
|
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
param(
|
||
|
[Parameter(Mandatory = $true)]
|
||
|
[string]$Value,
|
||
|
[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.Designation"
|
||
|
Value = $Value
|
||
|
ComputerName = $ComputerName
|
||
|
}
|
||
|
|
||
|
$appSetting = Set-AppSetting @params
|
||
|
Write-Verbose "$logLead : ComputerName: [$ComputerName] App Setting value: [$Value]"
|
||
|
return $appSetting
|
||
|
}
|