Automatiseren licentiebeheer in Business Central met PowerShell
Het beheren van meerdere Business Central‑instances kan dus tijdrovend zijn, vooral wanneer je licenties moet vernieuwen. Handmatig elke service tier openen, de licentie importeren en daarna opnieuw starten kost niet alleen tijd, maar vergroot ook de kans op fouten. PowerShell lost dit probleem dus elegant op. Met één script automatiseer je dus het volledige proces: licenties importeren én alle service tiers herstarten. In deze blog over licentiebeheer in Business Central laat ik zien hoe deze aanpak werkt en waarom PowerShell hierbij onmisbaar is.
Waarom PowerShell de beste keuze is voor licentiebeheer in Business Central
PowerShell biedt drie grote voordelen die je direct merkt:
- Snelheid: één commando verwerkt alle instances in één keer.
- Consistentie: elke instance krijgt exact dezelfde handelingen, zonder menselijke fouten.
- Controle: je ziet precies wat er gebeurt en kunt het script eenvoudig uitbreiden of aanpassen.
Voor beheerders die meerdere omgevingen draaien (zoals productie, test en acceptatie) is dit een enorme winst. Je hoeft niet langer elke instance handmatig te openen of door menu’s te klikken. PowerShell voert alles uit in een strakke, voorspelbare workflow.
De PowerShell‑functie die licentiebeheer in Business Central automatiseert
Onderstaande functie importeert een licentie in alle Business Central 23‑instances en herstart daarna automatisch alle service tiers. Zo weet je zeker dat de nieuwe licentie actief is in elke omgeving.
Import-Module 'C:\Program Files\Microsoft Dynamics 365 Business Central\230\Service\NavAdminTool.ps1'
$PathLicense = 'C:\Installation\Licenties\licentie.bclicense'
function Import-BC23LicenseToAllInstances {
param(
[Parameter(Mandatory = $true)]
[string]$PathLicense
)
# 1. Haal alle Business Central 23 instances op
$instances = Get-NAVServerInstance | Where-Object { $_.Version -like "23.*" }
if ($instances.Count -eq 0) {
Write-Host "Geen Business Central 23 instances gevonden."
return
}
# 2. Loop door elke instance en importeer de licentie in 3 databases
foreach ($instance in $instances) {
Write-Host "Verwerk 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 "Licentie geïmporteerd voor instance $($instance.ServerInstance)"
}
# 3. Herstart ALLE BC23 service tiers
Write-Host "Herstart alle Business Central 23 service tiers..."
foreach ($instance in $instances) {
$name = $instance.ServerInstance
Restart-NAVServerInstance -ServerInstance $name -Force
Write-Host "Service tier herstart: $name"
}
}
Import-BC23LicenseToAllInstances -PathLicense $pathLicense
Wat levert dit je op?
✔ Minder downtime
Alle service tiers worden pas na de volledige import herstart, waardoor gebruikers minimale hinder ervaren.
✔ Volledige automatisering
Je hoeft alleen het pad naar de licentie op te geven. De rest gebeurt automatisch.
✔ Perfect voor beheer op schaal
Of je nu 2 of 20 instances hebt: het script werkt altijd even snel.
✔ Eenvoudig uitbreidbaar
Conclusie
Tot slot. Het importeren van Business Central‑licenties hoeft geen handmatig, foutgevoelig proces te zijn. Met PowerShell automatiseer je de volledige workflow, bespaar je tijd en houd je volledige controle over alle instances. Zeker in omgevingen met meerdere service tiers is dit de meest efficiënte en betrouwbare aanpak.
Als je meer informatie wilt over PowerShell commands in Business Central, klik dan hier. Als je vragen hebt over deze blog post, contacteer mij dan via het contact formulier.