Patch/Cmdlets/NAV/Get-AdjacentInstances.ps1

function Get-AdjacentInstances {
    [CmdletBinding()]
    param (
        $MainInstance
    )
    process {
        $currentInstance = Get-NAVServerInstance $MainInstance
        $currentApp = Get-NAVApplication $MainInstance
        Get-NAVServerInstance | ? { $_.State -EQ "Running" -and $_.Version -eq $currentInstance.Version } | % {
            $app = Get-NAVApplication $_.ServerInstance
            if ($_.ServerInstance -notlike "*`$$MainInstance") {
                if ($app.'Database server' -eq $currentApp.'Database server' -and $app.'Database name' -eq $currentApp.'Database name') {
                    $_.ServerInstance
                }
            }
        }
    }
}

Export-ModuleMember -Function Get-AdjacentInstances