To-Increase Business Central Documentation

Update IEM

In C/AL based versions of NAV/Business Central functionality was updated through *.fob (or txt) files. As of the BC15 release functionality must be updated through replacing apps. Below is a description of the steps:

Start Windows PowerShell ISE as administrator

# When running this script in a seperate session in ISE we need to import the modules again (Make sure to select the correct version of the Program Files folder):
Import-Module "C:\Program Files\Microsoft Dynamics 365 Business Central\170\Service\Microsoft.Dynamics.Nav.Apps.Management.psd1"
Import-Module "C:\Program Files\Microsoft Dynamics 365 Business Central\170\Service\Microsoft.Dynamics.Nav.Management.psd1"

#This variable places the apps in the right order. When not updating all apps you can remove it/them from this list.
$apps = "TI-Common,IEM Application,Application,TI-Lifecycle Base,IEM Lifecycle,IEM Extended Application,IEM Advanced Application"
$serverInstance = 'BC170'
#Make sure to download and unzip the artifacts folder to the location where you are installing from.
$buildArtifactFolder = "C:\...\IEMNL17.0.44289.0"
$appsSplit = $apps.Split(',')
$i = $appsSplit.Count

#Uninstall and unpublish the previous versions of the apps:
Do{
    $i--
  Write-Host "Uninstall & Unpublish $($appsSplit[$i])"

  $installedAppVersion = Get-NAVAppInfo -ServerInstance $serverInstance|Where-Object { $_.Name -eq $appsSplit[$i] }|%{"$($_.Version.Major).$($_.Version.Minor).$($_.Version.Build).$($_.Version.Revision)"}
  Uninstall-NAVApp -Name $appsSplit[$i] -ServerInstance $serverInstance -Version $installedAppVersion
  Unpublish-NAVApp -Name $appsSplit[$i] -ServerInstance $serverInstance -Version $installedAppVersion
}
Until($i -eq 0)

#Publish and Install the new versions of the apps
$apps.Split(',') | ForEach-Object {
    $appName = $_
    $AllAppFiles = Get-ChildItem -Path $buildArtifactFolder -Filter "*.app" -Recurse
    foreach ($AllAppFile in $AllAppFiles) {if ((Get-NAVAppInfo -Path $AllAppFile.FullName |Select-Object -expand Name) -eq $appName){$appFileName = $AllAppFile.FullName} }
    Write-Host "Install $_ ($appFileName)"
    $newAppVersion = Get-NAVAppInfo -Path $appFileName|%{"$($_.Version.Major).$($_.Version.Minor).$($_.Version.Build).$($_.Version.Revision)"}

    Publish-NAVApp -Path $appFileName -ServerInstance $serverInstance
    Sync-NAVApp -Name $appName -ServerInstance $serverInstance -Version $newAppVersion
    Start-NAVAppDataUpgrade -Name $appName -ServerInstance $serverInstance -Version $newAppVersion
    Install-NAVApp -Name $appName -ServerInstance $serverInstance -Version $newAppVersion
}

NOTE Data is always retained in the SQL Server tables and not touched by any of these commands

To-Increase Common Documentation