License Management in Business Central

License Management in Business Central
License Management in Business Central

Automating license management in Business Central with PowerShell

Managing multiple Business Central instances can be time‑consuming, especially when you need to renew licenses. Manually opening each service tier, importing the license, and restarting the service not only takes time but also increases the risk of errors. PowerShell solves this problem elegantly. With a single script, you automate the entire process: importing licenses and restarting all service tiers. In this blog about license management in Business Central, I’ll show how this approach works and why PowerShell is indispensable for this task.

Why PowerShell Is the best choice for license management in Business Central

PowerShell offers three major advantages that you’ll notice immediately:

  • Speed: one command processes all instances at once.
  • Consistency: every instance receives the exact same actions, without human error.
  • Control: you see exactly what happens and can easily extend or adjust the script.

For administrators managing multiple environments (such as production, test, and acceptance), this is a huge benefit. You no longer need to open each instance manually or click through menus. PowerShell executes everything in a clean, predictable workflow.

The PowerShell function that automates license management in Business Central

Import-Module 'C:\Program Files\Microsoft Dynamics 365 Business Central\230\Service\NavAdminTool.ps1'
$PathLicense = 'C:\Installation\Licenties\licensefile.bclicense'

function Import-BC23LicenseToAllInstances {
    param(
        [Parameter(Mandatory = $true)]
        [string]$PathLicense
    )

    # 1. Get all BC23 instances
    $instances = Get-NAVServerInstance | Where-Object { $_.Version -like "23.*" }

    if ($instances.Count -eq 0) {
        Write-Host "Did not find BC23 instances"
        return
    }

    # 2. Loop through each instance and import the licence in 3 databases
    foreach ($instance in $instances) {
        Write-Host "Process instance: $($instance.ServerInstance)"

        import-navserverlicense -ServerInstance $instance.ServerInstance -licensefile $PathLicense -database default
        import-navserverlicense -ServerInstance $instance.ServerInstance -licensefile $PathLicense -database navdatabase
        import-navserverlicense -ServerInstance $instance.ServerInstance -licensefile $PathLicense -database master

        Write-Host "Imported license for instance $($instance.ServerInstance)"
    }
    # 3. Restart all BC23 instances
    Write-Host "Restart all Business Central 23 service tiers..."

    foreach ($instance in $instances) {
        $name = $instance.ServerInstance
        Restart-NAVServerInstance -ServerInstance $name -Force
        Write-Host "Restarted Service tier: $name"
    }
}

Import-BC23LicenseToAllInstances -PathLicense $pathLicense

What Does This Give You?

✔ Less downtime

All service tiers are restarted only after the full import, minimizing user disruption.

✔ Full automation

You only need to provide the path to the license. Everything else happens automatically.

✔ Perfect for scaled administration

Whether you have 2 or 20 instances, the script runs just as fast.

✔ Easy to extend

Add logging, notifications, filtering, or additional logic whenever you need it.

Conclusion

Importing Business Central licenses doesn’t have to be a manual, error‑prone process. With PowerShell, you automate the entire workflow, save time, and maintain full control over all instances. Especially in environments with multiple service tiers, this is the most efficient and reliable approach.

If you want more information about PowerShell commands in Business Central, click here. If you have questions about this blog post, feel free to contact me via the contact form.

0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like