#Created by Tech-Lucky read all the comments to understand the process. #https://tech-lucky.in/ # Import Module Set-ExecutionPolicy unrestricted -Force Import-Module 'C:\Program Files\Microsoft Dynamics 365 Business Central\190\Service\NavAdminTool.ps1' # Change the Path as per Yours Local or Server Import-Module 'C:\Program Files\Microsoft Dynamics 365 Business Central\190\Service\NavModelTools.ps1'# Change the Path as per Yours Local or Server # Init Variables $Sourcefolder = "H:\Apps" # Create a Folder in Your Drive to Place the App File that need to be Publish $ServerInstance = "BC190" # BC Running Instance Name # Get all granules / App Files from path $GranulesPath = Get-ChildItem -Path $SourceFolder -Include *.app -Recurse -Force | Sort-Object -Property @{Expression = "Length"; Descending = $True} foreach ($Appfile in $GranulesPath) { write-host -ForegroundColor Green -BackgroundColor Black "Found following apps to install : " $Appfile.BaseName } # Start installing each app one by one foreach ($Appfile in $GranulesPath) { $AppName = $AppFile.BaseName.Split('_')[1] $AppVersion = $AppFile.BaseName.Split('_')[2] $OldAppInfo = Get-NAVAppInfo -ServerInstance $ServerInstance -Name $AppName write-host -ForegroundColor Green -BackgroundColor Black "Installing : " $Appfile.BaseName Publish-NAVApp -ServerInstance $ServerInstance -Path $Appfile.FullName –SkipVerification Sync-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $AppVersion Start-NAVAppDataUpgrade -ServerInstance $ServerInstance -Name $AppName -Version $AppVersion foreach ($App in $OldAppInfo) { $App | UnPublish-NAVApp } } write-host -ForegroundColor Green -BackgroundColor Black "You have successfully installed Apps."