Update Extension (App)
The script imports the Microsoft.Dynamics.Nav.Apps.Management.dll
module, which provides the cmdlets that are used to manage apps.
Before running the script please fill out the variables
$NSTFolderPath
: the path to the folder containing the Microsoft Dynamics 365 Business Central server instance$ServerInstance
: the name of the Business Central server instance$AppName
: the name of the extension you want to update$OldVersion
: the version number of the old version of the extension$NewVersion
: the version number of the new version of the extension$NewAppPath
: the path of the .app file for the new version of the extension
It's worth mentioning that the script should be run on the same machine as the Business Central Server Instance or the server instance should be reachable using the specified name.
If you need to perform a ForceSync when performing synchronization of the extension use the script at ForceSync
And also, the script assumes that the user running the script has the necessary permissions to perform the above actions.
Please make sure that the variables are set correctly before running the script and that you have the correct version of the app package and that the path to the package is valid.
- Sync
- Sync (AppId)
- ForceSync
- ForceSync (AppId)
#-------------------------------PRE STEP-------------------------------
$NSTFolderPath = "";
$ServerInstance = "";
$AppName = "";
$OldVersion = "";
$NewVersion = ""; #Format: #.#.#.#
$NewAppPath = "";
#-------------------------------DO NOT EDIT UNDER THIS LINE-------------------------------
Import-Module (Join-Path $NSTFolderPath "Microsoft.Dynamics.Nav.Apps.Management.dll");
Uninstall-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $OldVersion -Force;
Publish-NAVApp -ServerInstance $ServerInstance -Path $NewAppPath -SkipVerification;
Sync-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $NewVersion;
Start-NAVAppDataUpgrade -ServerInstance $ServerInstance -Name $AppName -Version $NewVersion;
Install-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $NewVersion;
Unpublish-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $OldVersion;
#-------------------------------PRE STEP-------------------------------
$NSTFolderPath = "";
$ServerInstance = "";
$NewAppPath = "";
#-------------------------------DO NOT EDIT UNDER THIS LINE-------------------------------
Import-Module (Join-Path $NSTFolderPath "Microsoft.Dynamics.Nav.Apps.Management.dll");
$NewAppInfo = Get-NAVAppInfo -Path $NewAppPath;
$NewVersion = $NewAppInfo.Version;
$OldAppInfo = Get-NAVAppInfo -ServerInstance $ServerInstance -AppId $NewAppInfo.AppId;
$OldVersion = $OldAppInfo.Version;
Uninstall-NAVApp -ServerInstance $ServerInstance -AppId $OldAppInfo.AppId -Version $OldVersion -Force;
Publish-NAVApp -ServerInstance $ServerInstance -Path $NewAppPath -SkipVerification;
Sync-NAVApp -ServerInstance $ServerInstance -AppId $NewAppInfo.AppId -Version $NewVersion;
Start-NAVAppDataUpgrade -ServerInstance $ServerInstance -AppId $NewAppInfo.AppId -Version $NewVersion;
Install-NAVApp -ServerInstance $ServerInstance -AppId $NewAppInfo.AppId -Version $NewVersion;
Unpublish-NAVApp -ServerInstance $ServerInstance -AppId $OldAppInfo.AppId -Version $OldVersion;
#-------------------------------PRE STEP-------------------------------
$NSTFolderPath = "";
$ServerInstance = "";
$AppName = "";
$OldVersion = "";
$NewVersion = ""; #Format: #.#.#.#
$NewAppPath = "";
#-------------------------------DO NOT EDIT UNDER THIS LINE-------------------------------
Import-Module (Join-Path $NSTFolderPath "Microsoft.Dynamics.Nav.Apps.Management.dll");
Uninstall-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $OldVersion -Force;
Publish-NAVApp -ServerInstance $ServerInstance -Path $NewAppPath -SkipVerification;
Sync-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $NewVersion -mode ForceSync;
Start-NAVAppDataUpgrade -ServerInstance $ServerInstance -Name $AppName -Version $NewVersion;
Install-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $NewVersion;
Unpublish-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $OldVersion;
#-------------------------------PRE STEP-------------------------------
$NSTFolderPath = "";
$ServerInstance = "";
$NewAppPath = "";
#-------------------------------DO NOT EDIT UNDER THIS LINE-------------------------------
Import-Module (Join-Path $NSTFolderPath "Microsoft.Dynamics.Nav.Apps.Management.dll");
$NewAppInfo = Get-NAVAppInfo -Path $NewAppPath;
$NewVersion = $NewAppInfo.Version;
$OldAppInfo = Get-NAVAppInfo -ServerInstance $ServerInstance -AppId $NewAppInfo.AppId;
$OldVersion = $OldAppInfo.Version;
Uninstall-NAVApp -ServerInstance $ServerInstance -AppId $OldAppInfo.AppId -Version $OldVersion -Force;
Publish-NAVApp -ServerInstance $ServerInstance -Path $NewAppPath -SkipVerification;
Sync-NAVApp -ServerInstance $ServerInstance -AppId $NewAppInfo.AppId -Version $NewVersion -mode ForceSync;
Start-NAVAppDataUpgrade -ServerInstance $ServerInstance -AppId $NewAppInfo.AppId -Version $NewVersion;
Install-NAVApp -ServerInstance $ServerInstance -AppId $NewAppInfo.AppId -Version $NewVersion;
Unpublish-NAVApp -ServerInstance $ServerInstance -AppId $OldAppInfo.AppId -Version $OldVersion;