Scripts/Install-BcApp-Simple.ps1

# Specify the name of the Business Central Server Instance to use for the installation.
$ServerInstance = ''   # E.g. 'BC210' or 'BCS210Test'

# Import PowerShell module **
Install-Module FpsGeneral -Force
Import-Module  FpsGeneral -Force
Install-Module FpsBcDeployment -Force
Import-Module  FpsBcDeployment -Force

# Install Bc License
$supportedLicenseExtension = @('*.flf', '*.bclicense')
$licensePath = Join-Path $PSScriptRoot 'CustomerLicense.*'
$BcLicenseFile = Get-ChildItem $licensePath -Include $supportedLicenseExtension | Select-Object -First 1

$arguments = @{
    'ServerInstance' = $ServerInstance
    'LicensePath'   = $BcLicenseFile.FullName
    'Database'       = 'NavDatabase'
    'Confirm'        = $true
    'RestartServerInstance' = $true
}
Set-BcLicense @arguments

# Install Business Central extensions
$arguments = @{
    'SoftwareToInstallPath' = (Join-Path $PSScriptRoot 'Extensions\default_install')
    'SoftwareToPublishPath' = (Join-Path $PSScriptRoot 'Extensions\default_publish')
    'SoftwareToUpdatePath'  = (Join-Path $PSScriptRoot 'Extensions\default_skip')
    'ServerInstance'     = $ServerInstance
    'SkipMemoryCheck'    = $false
    'SkipVerification'   = $false
    'SkipServiceRestart' = $false
    'LogFilePath'        = (Join-Path -Path $env:ProgramData -ChildPath '4ps\bcdeployment')
    'ErrorAction'        = 'Continue'
}
Install-BcApp @arguments

# Start installation of the on-premises DotNet components.
# Note: Replacement for Nav .Net Components (NNC)
$arguments = @{
    'ServerInstance' = $ServerInstance
    'Path'           = (Get-ChildItem (Join-Path $PSScriptRoot 'DotNet')).FullName
    'Force'          = $true
    'ErrorAction'    = 'Continue'
}
Publish-BcAddin @arguments 

# **
# Alternatively the offline modules from the software delivery can be used:
# @((Join-Path $PSScriptRoot '\PowerShell\FpsGeneral\FpsGeneral.psd1')
# (Join-Path $PSScriptRoot '\PowerShell\FpsALDeployment\FpsBcDeployment.psd1')) |
# Import-Module -Global -DisableNameChecking -Force