functions/service/Restart-BcService.ps1

function Restart-BcService
{
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$true)]
        [string]$ServerInstance,
        [int]$WaitForTenantSleepSeconds = 1
    )

    Restart-NAVServerInstance -ServerInstance $ServerInstance
    while (Get-NavTenant -ServerInstance $ServerInstance | Where-Object { $_.State -eq "Mounting" })
    {
        Start-Sleep -Seconds $WaitForTenantSleepSeconds
    }
}