function Get-MasterConnectionString { <# .SYNOPSIS Returns the Master Database Connection String .DESCRIPTION Reads the value from the appSetting named "AlkamiMaster" from the machine.config ConnectionStrings block #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSPossibleIncorrectComparisonWithNull", "", Justification="Array Consolidation is Acceptable")] param() $machineConfig = Read-MachineConfig $masterConnectionString = $machineConfig.Configuration.ConnectionStrings.ChildNodes | Where-Object {$_.Name -eq "AlkamiMaster"} | Select-Object -ExpandProperty connectionString return ($masterConnectionString, $global:masterConnectionString -ne $null)[0]; }