Containers/Enable-SymbolLoading.ps1

<#
 .Synopsis
  Enables symbol loading in container
 .Description
  Enables symbol loading in container
 .Parameter ContainerName
  Name of the container. Can be provided in the settings.json
 .Parameter SourcePath
  Path to the current project
 .Example
  Enables-SymbolLoading
#>

function Enable-SymbolLoading {
    Param(
        [Parameter(Mandatory=$false)]
        $ContainerName = "",
        [Parameter(Mandatory=$false)]
        $SourcePath = (Get-Location)
    )

    if ($ContainerName -eq "") {
        $ContainerName = Get-ContainerFromLaunchJson
    }

    [version]$platform = Get-AppKeyValue -SourcePath $SourcePath -KeyName 'platform'
    if ($platform.Major -gt 11) {
        throw "You can only enable symbols for NAV 2018"
    }

    Invoke-ScriptInNavContainer -containerName $ContainerName -scriptblock {
        Set-NavServerConfiguration -ServerInstance NAV -KeyName 'EnableSymbolLoadingAtServerStartup' -KeyValue $true
        Set-NavServerInstance -ServerInstance NAV -Restart
    }
}
Export-ModuleMember Enable-SymbolLoading